How to clear application cache (HTML5 function) using JavaScript?

Our web application uses the application cache (cache manifest) to recover the HTML page and resources offline. HTML pages have sessionIDs as parameters in the URI. Thus, after each logout and logon, new HTML pages are stored in the application cache since sessionId has been changed to a URI. After several weeks of working with the application, some browsers start to work slower. The size of the application cache (tested on FF 3.6+) is about 200 MB! After each logout, we clear the LocalStorage browser, but how do I clear the resources from the application store?

+5
source share
2 answers

The problem with the application cache, which takes up so much space, is that each time you provide the user agent with another offline web application. The unauthorized web application is identified by the user agent by the URI of the cache manifest file , including the query string, and not the URI of the main file as you might think.

Thus, by including the session identifier in the manifest cache URI, you tell the browser that each session receives its new completely new application without using the previously downloaded ones (and therefore can never clear them). You install a different web application each time.

, , HTML5 - . , -, HTML , AJAX. - " HTML- ". .

+7

, JavaScript. , .

0

All Articles