|
Posted by Alan J. Flavell on 11/19/79 11:33
On Tue, 29 Nov 2005, Jim Higson wrote:
> oeb wrote:
>
> > <snip>
> > Using PHP you can force a page not to cache using the header function.
Well, it'll generate some HTTP headers which propose that behaviour to
clients and proxies. Whether they honour that proposal is not under
your control (often expressed by the slogan "force does not work on
the WWW").
> > <?php
> > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
> > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> > ?>
> >
> > see http://www.php.net/header
> > I'm sure you can do this with pretty much any language that can output
> > raw headers
>
> Indeed, or with no scripting at all, just configure the server to send the
> right headers.
Agreed. However, such a sledgehammer approach is rarely needed, and
can do more harm than good. I'd recommend a careful read of Mark
Nottingham's tutorial http://www.mnot.net/cache_docs/
> http-equivs would probably work too, if you can't change server settings.
Doubtful: see http://www.mnot.net/cache_docs/#CONTROL
Note also that once a page has been sent out without appropriate cache
control, and has been cached, there is nothing you can do to update it
from the server side, no matter how strongly you try. The client (or
proxy) simply WILL NOT look for a new version until it is good and
ready; and then, it will see that there is a new version, and will
fetch it, no matter what the (new) cache control headers say. I've
seen people driving themselves demented trying to force a page update
through, because they were confused about this. I'm not suggesting
that *you* are, but there might be someone reading this who could be
helped. And leaving no-cache headers lying around the place is not
good for the perceived responsiveness of a web site.
Of course, none of this answers the original poster's question!! HTML
(itself) is no way to control a browser's user options. Not even IE.
I suppose the best offer that a server can make is to set appropriate
cacheability headers (see the tutorial for suggestions), and leave the
user to make their own browser setting choices.
[Back to original message]
|