Search This Blog

Friday, August 06, 2010

Make Caching Less Aggressive in Firefox on Development Machines

I have been having some issues with Firefox caching files too aggressively on my development machine at work: not good when you write client-side code.

My first attempt to resolve the issue was to disable caching entirely using the Web Developer toolbar (Disable > Disable Cache). However, that is not optimal, as every page resource gets downloaded every time you refresh the page.

So I did some reading up, and, just as I suspected, there is a Firefox configuration setting that forces a 304 request each time you refresh the page. This solution is superior to disabling the cache, as only resources that have changed are downloaded again.

If you have caching problems (or you're concerned that you might), you'll need to change a value in Firefox's "power-user" configuration settings. Here's how:
  1. Open a new tab, type about:config into your address bar, and promise Firefox you'll be careful. ;)
  2. Enter browser.cache.check_doc_frequency into the filter field.
  3. Change the value from 3 to 1, which tells Firefox to check the server for updated resources on every refresh.
Further Information: For the full reference see here, and for a list of the seven hidden pages in Firefox, see The Seven "Hidden" Pages.