Home | All Questions | alt.html FAQ > Server-side basics

What is caching?

Page being cached? You can try one of two things:

  1. Add the meta tag PRAGMA with no-cache, in the HEAD; http://vancouver-webpages.com/META/metatags.detail.html
  2. Add an instruction for your viewer to [ctrl] [shift] + refresh

"Meta tags are easy to use, but aren't very effective. That's because they're usually only honored by browser caches (which actually read the HTML), not proxy caches (which almost never read the HTML in the document)."

If a page is changed "nearly every day", it will hardly be a problem in practical terms. And in any case, it's something to be handled at the server level, by making the server send some useful expiration information, using whatever needs to be done on a specific server. Telling that a page expired twenty years ago is hardly a good idea if you can expect its lifetime to be a day or more, or at least several hours. Defeating proxy caching brutally wouldn't be a good idea (and meta tags won't do that, so the errors in a sense cancel out each other, so to say :-) ).

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") ." GMT");
header("Cache-Control: no-cache, must revalidate");
header("Pragma: no-cache");
header("Cache-Control: post-check=0, pre-check=0");

This has to be at the beginning of the file, with nothing before (e.g. no blank). This is a brute force variation, some adjustments are useful. (Server supporting PHP is recommended)

Meta-tags wont work with proxies. Proxies don't work on the 'HTML-layer' but HTTP. Things depend on proxy settings also.

"The Pragma header is generally ineffective because its meaning is not standardized and few caches honor it. Using <meta http-equiv=...> elements in HTML documents is also generally ineffective; some browsers may honor such markup, but other caches ignore it completely." - Web Design Group

That's because the no-cache pragma is supposed to be part of a HTTP *request*. And *this* has been standardized since way way back when, e.g. Section 10.12 of RFC 1945 (the HTTP/1.0 spec), dated May 1996.

Recommended Resources

Related Questions