1

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 Answer 1

1

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.

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

1 Comment

That makes sense for me, I will try and keep you updated

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.