How to stop a browser caching data
This isn't a definitive guide on how to stop your browser caching data! Usually when people talk about not caching a web page the following meta tag crops up:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
As always, the technique you choose depends on which browsers are being used and if you are using server side processing.
The Pragma statement up above sometimes fails in IE because of the way IE caches files. There is a 64K buffer that must be filled before a page is cached in IE. The problem is that the vast majority of the pages using the Pragma statement put it between the HEAD tags.
The HEAD loads and the Pragma comes into play. The browser gets the go ahead to not cache the page, however there is not yet a page to not cache.
The solution is to play to the buffer. Place another set of HEAD tags at the bottom of the document, before the end HTML tag and re-enter the Pragma.
Pragma doesn't work in Internet Explorer 5
In order to assure a non-cache, you'll need to add another meta tag:
&pt;META HTTP-EQUIV="Expires" CONTENT="-1">
That sets an immediate expiration on the file. Thus it dies the moment is it born. Place it on your page in the same manner as above.
ASP Pages use this
You can use Microsoft Information Server (IIS) to easily mark highly volatile or sensitive pages using the following script at the extreme beginning of the specific Active Server Pages (ASP) pages:
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Netscape Navigator
Netscape suggests the following JavaScript be used in the BODY tag of all pages that should not be cached:
onLoad="if ('Navigator' == navigator.appName) document.forms[0].reset();"
Published Wednesday, June 02, 2004

