: How can I cause a browser to download a new copy of a web page when it thinks that its cached copy is still valid? Sometimes when I make small changes to a website, I notice that certain
Sometimes when I make small changes to a website, I notice that certain browsers are very stubborn about downloading the page again. Both F5 and CTRL-R are worthless and the only way to fix it is to go through the options and manually tell it to clear the cache. I've used PHP before to send a cache-flush header, but is there a simpler or better way?
More posts by @Heady270
2 Comments
Sorted by latest first Latest Oldest Best
It depends on what's cached. If it's the main page then the only way to prevent caching is using the no cache HTTP header.
However keep in mind that JS and CSS files are also usually cached. One trick to invalidate them when they change used by many websites - including this - is appending a dummy number after the '?'. Everything after the '?' is ignored by the web server, but since the URL changes the browser always re-downloads it.
An example taken from this very page: sstatic.net/webmasters/all.css?v=ac775b7bd951. The "ac775b7bd951" comes from mercurial, the versioning system used. You can do something similar with svn (example: all.css?revision=123).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.