Question

I know that the manifest attribute needs to be added to the in every file desired to be cached, I have found MANY sources that say that, but none that explain why. I would really like to know why this is required.

I assume that it's like linking a stylesheet to a file. Is this a correct assumption?

Warmth.

Was it helpful?

Solution

I'm making an educated guess here; I'm not certain that this is the reason.

If you have more than one HTML page which is part of your app and you have the manifest declaration only on main.html but your user comes back to your app (already installed) and loads display.html which doesn't have the manifest declaration, the user's browser won't know that the page in the cache is part of an offline application instead of just being "in the cache". The browser will then validate online that the cached page is still valid. If the user's browser is offline, the browser will then complain that it can't load the page.

Conversely, if the user visited main.html, the browser will look at the page it found in the cache, see the manifest declaration and show the app while checking online if the manifest file is still valid. If the browser is offline, then it will just use the cached files and not show the user any error because the file displayed (main.html) is considered valid since it is part of the "offline" portion of the application and the browser couldn't "prove" that the file was invalid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top