ค้นหาฝ่ายสนับสนุน

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

เรียนรู้เพิ่มเติม

Firefox cache issue - not requesting resource

  • 5 การตอบกลับ
  • 2 คนมีปัญหานี้
  • 8 ครั้งที่ดู
  • ตอบกลับล่าสุดโดย cslewis2015

more options

We recently updated a javascript file in our application, but firefox (35.0.1) doesn't even send a request to the webserver to determine if the resource has been updated.

To be specific, unless I hit F5 or ctrl-r, and simply revisit a URL, firefox does not send anything to the web server, and simply serves up its local cached copy of the web page, and any other resources contained within that page.

This causes a problem for our customers who have no way of knowing that they have to somehow clear their cache.

Is there anything we can send to firefox in terms of a header or meta tag that will force it to always check if a resource has been updated? E.g. firefox should send a request with If-Modified-Since / If-None-Match headers and depending on what comes back from the web server should either use its local copy (if it gets back a 304) or accept any new content (if it gets back a 200).

We recently updated a javascript file in our application, but firefox (35.0.1) doesn't even send a request to the webserver to determine if the resource has been updated. To be specific, unless I hit F5 or ctrl-r, and simply revisit a URL, firefox does not send anything to the web server, and simply serves up its local cached copy of the web page, and any other resources contained within that page. This causes a problem for our customers who have no way of knowing that they have to somehow clear their cache. Is there anything we can send to firefox in terms of a header or meta tag that will force it to always check if a resource has been updated? E.g. firefox should send a request with If-Modified-Since / If-None-Match headers and depending on what comes back from the web server should either use its local copy (if it gets back a 304) or accept any new content (if it gets back a 200).

การตอบกลับทั้งหมด (5)

more options

Hi there!

I'm not a cache expert, but I believe sending the Cache-Control: must-revalidate header should force Firefox (and other browsers) to check that the asset hasn't changed, and reload it if it has.

Let us know whether this helps!

more options

Thanks for your reply, You are correct that if had been sending those cache-control headers ahead of time, then firefox would have performed a GET on the resource.

Unfortunately, there doesn't seem to be away to send something now to firefox to force it to revalidate resources that it already has cached.

Unless we change the names of the resources.

more options

By default, Firefox will use a file from cache if it has not expired, and if there is no ETag, may not check for updates at all, or may check only at long intervals. (Users can modify this using the browser.cache.check_doc_frequency preference but that doesn't help you on the server side.)

To view details of the cache entry for your .js file, you can add its URL to the end of this:

about:cache-entry?storage=disk&context=&eid=&uri=

and submit that via Firefox's address bar.

more options

cslewis2015 said

Unfortunately, there doesn't seem to be away to send something now to firefox to force it to revalidate resources that it already has cached.

A common trick is to add a query string, in other words:

myscript.js?ver=20150715

more options

Thanks for all the replies- this is a common problem that can't really be solved after the fact - you have to remember to either set up your .htaccess or application to send the appropriate cache-control headers when you first launch your site.

Firefox seems to the worst offender in that it doesn't check ETAG or Last modified if it thinks it's cached copy of the resource is valid.

There should really be a domain level cache control header that the server can send back on any resource (like the initial page) that tells the browser to invalidate any cached resources.