Caching in Firefox 3

@tadej told me a few days ago at the Firefox 3 launch party that he had issues with the way caching is handled in Firefox 3. I didn’t have such issues myself but it reminded me that I didn’t change the caching behavior when I installed it. So yesterday I opened the preferences and found the caching options under Advanced / Network. I was not really surprised that the options for how the cache works were missing — you really don’t want your everyday Joe to change this stuff since it may affect the perceived speed of the browser.

Since this was probably just left out of the interface I opened about:config and filtered with cache which gave me a few entries. The most interesting one was browser.cache.check_doc_frequency. Unfortunately it has a numeric value with a hidden meaning. And I had no idea what that meaning is.

I googled the thing and found a mozillaZine article about it. It explains how it works — the property defines how often the browser checks for a new version of a specific file. The possible values are as follows:

0
once per session
1
everytime
2
never
3
when out of date (default)

The default is 3 which is not very good for development purposes when you want changes to take effect immediately. What you want is 1 which means that every request will go to the server every time. You’ll get many 304s but you’ll also get a 200 as soon as a file changes on the server. So I changed the value to 1 and now I’m a happy developer.

Zemanta Pixie

12 Responses to “Caching in Firefox 3”

  1. fjodor says:

    oh, great, im not alone noticing this… i am wondering do my visitors see my changes immediately or is there any meta tag i should use to force refresh for them… i cant expect them to tweak the browser :/

  2. fjodor says:

    btw: i already am using

    but it does not seem to work in FF3 properly.

  3. ago says:

    Found your blog. FF3 caching bothers me too. Although changing this value didn’t change anything. It still is caching. Currently have to use IE for development :(

  4. Adam Morse says:

    Yeah, this was killing me…I kept thinking my CSS was bad…I would use safari, or a myriad of other browsers before I switched exclusively to IE for development purposes. But…using firefox 2 is also still an option if you use a profile manager.

  5. Tom says:

    Thank you for this tip! I was going crazy, thinking FF was refusing to load changes from my local machine, which never happened before.

    Does anyone know what the expire date gets set to if neither the server nor the http-equiv meta tags specify it? Seems weird that FF would opt not to retrieve the page if it didn’t know an explicit expire date.

    And Adam, I’ve found it’s a bad idea to use IE as your dev environment–FF, Opera, Safari usually agree quite closely on positioning issues, and IE is the odd man out. Developing for compliant browsers and “tweaking” IE into place keeps me much more sane than the other way around. Just my $0.02.

  6. ben says:

    +1 to everything that tom said about developing in ie, and also don’t forget firebug. i couldn’t develop with out.

    but regarding the actual topic, i too was getting very frustrated by development in firefox 3 and had fallen back to just manually clearing the cache every time i made a change — a very annoying process.

    thanks for the fix, now i’m a happy developer too

    i wish the ff3 release notes had made a specific note of this

  7. Fabrice says:

    Thank you ! It drove me nuts !

  8. Brijesh says:

    I have done this and still it does not seem to resolve the caching issue in Firefox 3.
    Has anyone tried something else too ?

  9. What you can try is setting browser.cache.memory.enable and browser.cache.disk.enable to false which is what Web Developer Toolbar does when you disable cache.

    There’s also a setting called network.http.use-cache which is a boolean but I have no idea what it actually does – it might be that it only allows the use of caching headers on HTTP.

  10. jesse says:

    I set this value to 1 and it is still caching certain pages. Super…

  11. Sharron says:

    I my gosh I don’t have to do myself in! This was driving me absolutely bonkers.

    Ya can’t develop with this issue, I got rid of 3 and went back to version 2.

  12. Mike says:

    This is a ridiculous “enhancement”. So Mozilla wants the perceived speed of the browser to be higher than other browsers’ at the expense of the user getting stale information.

    I send explicit cache-control headers as well as ETags, but FF3 refuses to honor them unless the browser.cache.check_doc_frequency is set to 1. Even then, it only respects my headers *sometimes*. This really needs to be fixed.

    IE 7 and 8, Opera and Chrome all behave as they’re supposed to according to HTTP specs. C’mon Mozilla – get with the program.

Leave a Reply