Detect if browser cache is full

We found that full browser caches are causing the problem on our extranet. This affects only a small number of our users, but we would like to warn them about the problem and give them some guidance on how to fix the problem for ourselves.

We would like to use a similar system with the one used by GMail. When it discovers that the browser cache is full, it doesn’t work as it should, it displays a warning informing users that their cache is full and that this may cause problems with GMail, as well as a link to the Gmail Help page about clearing the browser cache .

Does anyone know if there are any resources or examples of using JavaScript to detect that the full browser cache is not working well?

Thanks.


Clarification:. In fact, we are trying to detect whether the cache is full, but rather whether the script that we configured on the server side to be stored in the cache is repeatedly requested from the server - so that the browser behaves strangely, or as if its cache is not behaves as it should.


Further clarification: Thank you for caching updates. Our scripts are sent with the correct headers, and we see this problem only in IE6 and IE7 - the Mozilla and WebKit browsers seem unaffected - but I'm still not sure how we will use JavaScript and / or XmlHttpRequest to check if the object was extracted from the cache, which allows us to check whether the cache works poorly.

+7
javascript caching gmail
source share
3 answers

The browser cache will not cause problems if it is full ... with a few minor notes.

  • If the browser cache is full, the browser just needs to download fresh content and pull it out of its local cache. (e.g. slower)
  • If the browser cache contains invalid data (for example, an old copy of the JavaScript file), then yes, you may run into problems. (not because the cache is full, but because you did not upload a fresh file for the user (Google for: expires headers and how to change the URL path to your files when making script changes to make sure that you "break" the cache))
  • In Internet Explorer, when you download a download file (for example, an Excel spreadsheet) to the user, he must go to the cache to work (IE error). I am not sure if the file is larger, the general cache, if it causes problems with the stored file and, therefore, is loading (Stackers pls feel free to confirm, anyway)

Update: Based on your clarifications, you need to make sure that any script that you send to the client is cached appropriately ... which means:

  • Change the url to your scripts when you want to download a new version (e.g.).
  • Once you are sure that the URL has changed, you can send cache headers that tell the browser about file caching for a very long time (like your JS library files (like jQuery) probably don't change every hour week or even month).
+5
source share

This probably will not work as it is. But its just an idea:

 var img = new Image(); (new Image).src = "imageWithFarFutures.png"; window.onload = function(){ document.getElementById("someIframe").src = "imageWithFarFutures.png"; // NOW if the server DOES get a FRESH request for "imageWithFarFutures.png" // wouldn't it mean that the browser has kicked it out of its cache? }; 
0
source share

Consider sending a header so that your application never caches your content and expires immediately.

0
source share

All Articles