How to turn off the Firefox cache?

73

22

I'm using Firefox 3.5.2. For some reason, it has cached a page and won't update. For example, I added an alert('test'); statement to some JavaScript code which is loaded on the page, but Firefox doesn't see it. When I do a view source, I still see the old code.

So I'm guessing this is a cache issue. How can I fix it, or can I make Firefox never cache anything from http://localhost?

Click Upvote

Posted 2009-08-15T10:08:30.477

Reputation: 4 000

Answers

32

You can force all requests relating to a refresh to actually be requested from the server (bypassing any already cached content, and updating the cache with the new version) by using Ctrl+F5 instead of just F5.

This does not work for requests made by the page within client-side code though. When that is a problem you need to use the POST method (POST requests should never be cached) instead of GET or add an ever-changing value to the query string (such as the current time in ms).

David Spillett

Posted 2009-08-15T10:08:30.477

Reputation: 22 424

Using angular to fetch templates with XHR calls you can press the entire keyboard with F5 but it'll still fetch the cached template. Do does any ajax request from script. – HMR – 2014-07-17T13:29:43.287

@emgee, That would give you a different page depending on your server. – Pacerier – 2015-09-02T03:48:35.460

ctrl+shift+R is ok with Ubuntu 16.04, in my installation ctrl+F5 launches a terminal. – j.c – 2016-11-07T17:00:29.660

1Another trick is to add a question mark to the end of the url. – emgee – 2011-04-04T23:32:42.507

2What is the mac shortcut? – Evanss – 2013-04-15T13:24:05.353

3for mac its Shift+CMD+R – Hans – 2013-08-27T04:14:57.907

13Also ctrl+shift+R, which doesn't require as large a hand spread if done one-handed. – Anonymous – 2009-12-25T04:41:18.883

89

Turn off the caching for a particular page. the correct way is to set the cache directive in Http request:

Cache-Control: no-cache

turn the entire Firefox caching capability off through its about:config page

network.http.use-cache = false.

joe

Posted 2009-08-15T10:08:30.477

Reputation: 11 615

1

If you landed here through google and do not have an ancient firefox: http://askubuntu.com/questions/776522/how-to-disable-cache-in-firefox

– scones – 2016-11-23T11:24:12.253

@NathanC.Tresch: Not useless, but simply not answering the question. – Zaibis – 2017-09-08T11:29:18.563

It seems to be outdated. With Firefox 63 the key to set to false is browser.cache.memory.enable – AnthonyB – 2018-07-25T12:31:36.033

5Spot on with about:config. When using the HttpFox extension, I’ve found that Cmd+Shift+R (I’m on a Mac) doesn’t always result in everything being fetched from the cache. Turning the cache off in about:config seems to work reliably though. – Paul D. Waite – 2010-10-15T11:49:08.493

9Note that this should be the accepted answer, the one that's accepted is useless. – Nathan C. Tresch – 2013-09-13T14:55:02.067

44

If you use FireBug, on the Network tab's drop down menu there is an option do disable the browser's cache.

goliatone

Posted 2009-08-15T10:08:30.477

Reputation: 582

1Built-in developer tools also have this option now. – jahu – 2017-03-05T17:36:21.743

The drop-down menu seems to have disappeared entirely. – T.J. Crowder – 2017-06-30T14:15:56.873

11

If you install the Web Developer addon, it gives you an extra toolbar where you can disable the cache among other things. I highly recommend that and Firebug if you are working on webpages or scripts.

JamesRyan

Posted 2009-08-15T10:08:30.477

Reputation: 1 591

11

Firefox addon CacheViewer allows you to explicitly delete a specific cached page.
I find it quite useful when Superuser-Beta updates and my cache causes things to vanish from the edit pages.

There is one more addon called JohnnyCache at this article.

In theory, Johnnycache can prevent cache access for individual files or paths - which would be perfection. In practice, this doesn't work in some cases (maybe I'm giving it the wrong path somehow).

You can use Johnnycache to block caching for the entire site under development (just use yoursitename.com). This always works, but it can slow down loading of complex pages. But I'd suggest doing this when you first install Johnnycache, to get an idea how it works.

The bad thing is that Johnnycache doesn't work for Firefox 26.0

nik

Posted 2009-08-15T10:08:30.477

Reputation: 50 788

Why's it called JohnnyCache? – Pacerier – 2015-09-02T03:49:09.983

@Pacerier - The name is likely in reference to "Johnny Cab" from the 1990 movie "Total Recall". – Neil C. Obremski – 2018-10-31T20:20:54.310

3

I would say that the best way I have found is to click on TOOLS in firefox and start private browsing which does not cache any pages and will restore any pages you had open prior to going in to PRIVATE BROWSING. Nice feature.

Shawn

Posted 2009-08-15T10:08:30.477

Reputation:

2

On android devices, use the following settings in about:config to disable the browser cache:

browser.cache.disk.enable = False
browser.cache.memory.enable = False

ansi_lumen

Posted 2009-08-15T10:08:30.477

Reputation: 219

1

In newer versions, you can set up Firefox so the http cache is disabled whenever you have the Inspector open, which is very handy for development. (I'm using Firefox Developer Edition 61)

  • Open the Inspector (cmd + opt + i on Mac).
  • Open settings by clicking the three dots at the top-right of the Inspector and then selecting "Settings"

enter image description here

  • On the page that opens, make sure the following option is checked under "Advanced settings:" "Disable HTTP Cache (when toolbox is open)"

enter image description here

That's it. Whenever you have the Inspector open, the cache will be automatically disabled.

Nathan Arthur

Posted 2009-08-15T10:08:30.477

Reputation: 155

0

2018 - about:config settings

In 2018 some of the Firefox about:config settings mentioned in earlier answers no longer exist.

In about:config settings, to turn off Firefox web cache set-: ** browser.cache.disk.enable**=false


Private Browser

Another way to disable cache is to simply open a Private Browser using the hamburger menu or shortcut CTRL + SHIFT + P

suspectus

Posted 2009-08-15T10:08:30.477

Reputation: 3 957

0

On Firefox 4, use about:config. In the filter, type cache. Toggle all toggles to false. Be careful, don't change any sizes, just the toggles.

Then use Ctrl + F5 for the refreshes. This also works well for page speed testing.

Joe

Posted 2009-08-15T10:08:30.477

Reputation: 182

is there any way to reliably test that the cache is disabled for good? – Xonatron – 2012-02-15T17:42:01.663