Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- caching problem
October 4, 2005, 2:38 pm
rate this thread
I have to use a flash file as an intro (customer requirements) with a
dropdown to select countries. After the user has selected a country, I
transfer to a frame page.
The FramePage (created by PHP) searches a directory and displays the files.
If I add or delete a file and refresh the page by F5 (IE), I will not see
the changes most of the time, although I have these code of lines in the
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
What can I do? Could I use a variable in the session management, for example
the time/date to make the browser / caching system think, that the page has
Or is there another solution?
Thanks for any hints
Re: caching problem
On Tue, 4 Oct 2005, Stuart wrote:
Sounds like the kind of site I'd never visit a second time, unless
there was some *really* compelling reason. From that description, it
seems it pushes most of my "run away, run away" buttons...
Is this about you, or about your users? Is it life-critical to your
users that they never get a page that's out of date by even a few
If you're only trying to review your *own* updates, then surely the
clue is to use your browser to reload the new version. Don't nobble
the server just for your own convenience.
Don't do that, it's a "cure" that's far worse than the disease, and
anyway it doesn't (in general) work.
And, contrary to what seems to be popular superstition, when it works
at all, it acts on the HTML object which contains it, and not on the
images, flash files and other stuff to which that object links.
(Unless you happen to have found some browser-like object whose
response is even worse than normal, due to having to keep re-fetching
even the objects which never change...)
What I'd recommend is:
* Have a read of the principles set out in Mark Nottingham's tutorial
* Work out what you (or rather, the site's readers) *really* need in
terms of updates, versus cacheability => speed of response.
* Implement it...
Yup, though the actual details of how to do that depend on the browser
You'd certainly be advised to put any cache-control statements into
the real HTTP header, and indeed PHP can do that, as you rightly say.
(But check what you're going to do for non-HTML objects too!).
However, "Pragma: no-cache" (an HTTP/1.0 kludge) is an unnecessarily
crude sledgehammer for achieving what's wanted here, at least with any
server version from this millennium.
I particularly recommend an occasional spin with Nottingham's
"cacheability engine", referenced in the above-mentioned tutorial.