1
votes

I want to make my web applications accessible offline, I'm using application cache to do that.

the main issue i'm facing is how to update the cache every time the user is online, I was reading that the only solution to force the browser to update the cache is to modify the manifest file (correct me please if I'm wrong).

So how I would be able to update the cache without editing the manifest file.

var appCache = window.applicationCache;
appCache.update();
if (appCache.status == window.applicationCache.UPDATEREADY) {
appCache.swapCache();
}

this code requires the manifest file to be changed, how could that be possible without modifying the manifest file ?

1

1 Answers

1
votes

You could simply include the session id in your manifest attribute. That way every time you're online a 'different' manifest will be loaded.

<html manifest="example.appcache?<?=session_id()?>">

Note: I never used such a construction, but from my understanding of the spec it should result in the desired behaviour. If it does not you could include a session string in the appcache file itself as well.