5

Our Web-Application uses Application cache (cache manifest) to restore HTML page and resources in off-line mode. HTML-pages have sessionIDs as params in URI. So, after each logout and login action new HTML-pages are saved to application cache because sessionId was changed in URI. After some weeks working with application some browsers start work slower. And size of Application cache (tested on FF 3.6+) is about 200Mb! After each logout we clear LocalStorage of browser,but how to clear resources from Application storage?

5
  • You say 'new HTML-pages are saved to application cache' - this doesn't seem right? A browser handles the application cache as a whole, there is no way to atomically add pages to the application cache. Can you please clarify? Commented Apr 29, 2011 at 7:45
  • I use Fallback section of cache manifest in way: mysite.com/?SID=123456&a=1 mysite.com/?SID=123456, So, static pages are downloaded and saved to cache. Each Logout/login generate new sessionId that leads to storing new static pages. Commented Apr 29, 2011 at 9:44
  • Stuff in the application cache shouldn't change every session, what's the point of storing it for offline use if it's going to change? Put static content in the application cache, use local storage and AJAX to load the session specific data so you'll have control over it from JavaScript. Commented Apr 29, 2011 at 10:11
  • I understand you point of view but I use dynamic cache manifest file and to get it I add a sessionId to URL of manifest file in <html manifest='?action=getmanifest&sessionId=1234567'> Without sessionId there is no way to get resources and correct result from server. So, as I understood after each generating new session size of cache is getting bigger because of sessionId in dynamic manifest file URI. Commented Apr 29, 2011 at 11:18
  • 1
    Ahh, there's your problem... you're giving the user a different web app every time. Commented Apr 29, 2011 at 12:57

2 Answers 2

7

The problem with the application cache taking up so much space is that you are giving the user agent a different offline web application each time. An offline web application is identified to the user agent by the URI of the cache manifest file, including query string - not the URI of the master file as you might think.

Thus, by including the session ID in the cache manifest URI, you're telling the browser that each session gets its own brand new application without using any of the previously downloaded ones (and thus, never being able to clear them out). You're installing a different web application every time.

Reconsider how you're architecting your application, as currently using HTML5 offline cache manifest is providing no value - just causing excessive downloading. The architecture that web applications encourage is serving all HTML statically, and fetching data that requires sessions via AJAX. Web applications don't work when built in the classic "dynamically generate an HTML page with data on the server" paradigm.

Sign up to request clarification or add additional context in comments.

1 Comment

The problem is fixed by temporary solution: client gets sessionId via cookies and URI to manifest file doesnt include sessionID-as a result the only one ApplicationCache object in browser with static name(without sessionId). @Stoive- sorry, cant add reputation bkz I`m a new user here:)
0

I'm not sure you do have control over application cache from JavaScript. This is something which should be handled by the browser and the user when clearing the cache.

3 Comments

The main problem is that users who use our web-Application do not have rights to clear cache from browser using standard methods of browser. The devices(OS,browser) is limited very much and browser Options are restricted for them
Perhaps the following extension might help ? sites.google.com/site/keigoattic/home/…
You can manually trigger an update through JavaScript, but that's about it: whatwg.org/specs/web-apps/current-work/multipage/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.