Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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: http://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).

share|improve this answer

F5 is refresh using the cache. Ctrl-F5 will ignore the cache. I'm not certain, but it sounds like Ctrl-R is equivalent to F5 rather than Ctrl-F5?

share|improve this answer
    
Yep that's right. Although I believe in Opera Ctrl+F5 reloads ALL the pages. –  DisgruntledGoat Jul 13 '10 at 12:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.