0

Imagine the following situation: a user comes to the website and he plans to use it offline. So we cache the items /a, /b and /c. Then the Appcache manifest should look like this:

CACHE MANIFEST # user foo CACHE: /a /b /c NETWORK: * 

A day later he comes back and the user would also like to use /d offline. So we would change the manifest to:

CACHE MANIFEST # user foo CACHE: /a /b /c /d NETWORK: * 

Now question: can we prevent the user's browser from refetching /a, /b and /c?

And is the inverse possible? I.e. removing a resource without refetching the rest?

1 Answer 1

1

No, according to the spec, if the manifest has changed then all the resources are downloaded and cached again.

http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#appcacheevents : When the user visits a page that declares a manifest, the browser will try to update the cache. It does this by fetching a copy of the manifest and, if the manifest has changed since the user agent last saw it, redownloading all the resources it mentions and caching them anew.

Edit: I don't generally work in Firefox, but their documentation has the following caveat: If the manifest file has changed, all the files listed in the manifest—as well as those added to the cache by calling applicationCache.add()—are fetched into a temporary cache, following the appropriate HTTP caching rules. For each file fetched into this temporary cache, the browser sends a progress event to the applicationCache object. If any errors occur, the browser sends an error event, and the update halts.

So, if the cache was sufficiently long on a,b,&c maybe they wouldn't be downloaded again? With Safari, I seem them downloaded again.

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

1 Comment

Ok thanks. In fact even in Firefox the function is called 'mozAdd', at least in the build I use...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.