Ashish Choudhary
Ashish Choudhary

Reputation: 2034

Firefox stores cache even if meta tag is set to no-cache, no-store, must-revalidate and setting expires and pragma

It was required not to store any cache for Firefox. Seemed an easy task to me till when I've found that its becoming next to impossible to accomplish that.

I first tried it using HTML, but it didn't worked:

<!-- Cache control -->
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

Then tried with PHP, still didn't worked:

<?php
header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.    
?>

The interesting part is that it showed the proper response headers this time (which was not in case of HTML).

Proper Response headers

But still, when I used work offline mode from File > Work Offline in firefox menu, the cached pages showed up.

I have tried it with CTRL + f5. It only works when we clear the cache manually from firefox settings. But we cant ask the user to clear their cache after every page refresh.

There is a link on mozilla that says that "Yup, we even store "no-cache" documents in our cache for the reasons enumerated above."

Mozilla Link

Tried things from mozilla caching help guide as well without any further luck.

Mozilla help guide on caching.

help me on this guys. Firefox wont let me prevent cache storing. It seems as if firefox is so heavy browser that they need caching at every step and document for it to work just OK.

Thanks in Advance.

Upvotes: 5

Views: 1824

Answers (0)

Related Questions