This question about Issue in browser: Answered
How to force a page to skip cache? Issue:
I have a topic with a .doc attachment that is sometimes updated. However, when visitors come to the topic and click the attachment link, they get the old version from the cache and not the new version from the server.
Can I force a page (including its attachments, or specifically just the attachment) to be loaded from the server at all times?
The normal tactics for expiring the browser cache are:
- Deliver the data with a cache header
- Change the link in some way so that it isn't matched the same way again
When you click on an attachment link in a topic view, you are simply making a reference to a file in the Foswiki 'pub' area on the apache server. Apache takes over from there, and delivers the file to the client. I imagine that apache will support some way to force a cache header onto files referenced from the pub header, but I haven't researched the subject. I suspect it will probably involve mod_expires
Changing the link in this case involves a trivial edit to one of the template files,
. Find the following fragment in that file:
and change it to this:
. the addition of the t=GMTIME parameter will ensure that a different link is used each time the file is downloaded, as long as the page being viewed has been refreshed since the attachment last changed.
This second technique works, but only affects the link in the attachment table at the foot of the topic. Links to attachments in the body text will still work the old way. So if you can find a solution using Apache, that would be best.
- 09 Apr 2009