DR. WEBSITE
Making Browsers Read Dynamically Generated, Not Cached, Pages
Dear Dr. Website®: We're trying to develop a Perl script on our site that will generate pages on the fly, but it looks like visitors keep pulling up previously cached pages instead. Is there any way to prevent these pages from being cached? Many sites use dynamically generated pages to introduce an element of randomness or to display completely new content on each access. In these cases, you should make sure your documents display a header that reads "Pragma: no-cache." Most browsers recognize and adhere to the "Pragma: no-cache" header.To implement this in a CGI-generated page, try including the following two lines in your Perl script: print "Content-type: text/html", "\n"; print "Pragma: no-cache", "\n\n"; You can also use the <META> tag to produce this same effect, and this would be the strategy to take if you have any static HTML documents that you'd like to keep from being cached. In other words, you could use a <META> tag placed in your document's <HEAD> section to ensure that pages you update manually instead of generate dynamically via scripting are not kept in the browser's cache either. Here's how you would specify this in a <META> tag:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">You might also be interested to know that the HTTP 1.1 specification introduces some new values for "Pragma"; these are designed to optimize persistent Internet connections. You can find more information about HTTP 1.1 at the W3C's Hypertext Transfer Protocol Overview page.Another way to make your pages update dynamically is to compel them to reload after a fixed period of time. You can modify your Perl script (or the <META> equivalent) similarly to specify the time after which the page must be loaded again. This is probably the most widely used function of the <META> tag, and is also known as client pull. Here's an example of what the syntax looks like:
<META HTTP-EQUIV="Refresh" CONTENT="30">The CONTENT attribute shown here measures in seconds the amount of time you want to wait before the server reloads the page.
Filling in Forms with Ease
Dear Dr. Website®: I'm creating a form for my Web site for the first time, and I'm having trouble making one of the text entry fields as user-friendly as I want it to be. On the form, I have a large section that I created with a <TEXTAREA> tag where readers can type in comments or questions. When someone fills it out, though, the cursor doesn't automatically move down to the next line. Instead, readers see their comments entered on one long line, so they have to press the scroll bar to see their whole comment unless they manually add their own carriage returns. I know that I've seen forms that wrap around the text in this kind of field. Can you tell me how to fix this? Netscape created a proprietary attribute for the <TEXTAREA> tag called WRAP back when it released Navigator 2.0; it's designed to create the word-wrapping effect you describe. If any of your visitors use browsers that don't support this proprietary extension, the feature will be ignored. Here's an example of how this attribute might look as part of a sample <TEXTAREA> tag:<TEXTAREA WRAP=PHYSICAL COLS=60 ROWS=12 NAME="comments">The default value for the WRAP attribute is OFF, meaning no word-wrapping. You could also set WRAP=VIRTUAL, which will cause the display in the <TEXTAREA> field to word-wrap,at least according to what your Web visitor will see, but the words are not sent wrapped when the form is submitted.Set WRAP=PHYSICAL to make both the display and the transmitted data word-wrap.
Reprinted from Web Week, Volume 3, Issue 8, March 31, 1997 © internet.com Corporation All rights reserved. Keywords: html Date: 19970331
![]()