It seems that once you have a manifest entry, a la:
<html manifest="cache.manifest">
Then that page (the master entry in the cache) will always be cached (at least by Safari) until the user does something to remove the cache, even if you later remove the manifest attribute from the html tag and update the manifest (by changing something within it), forcing the master entry to be reloaded along with everything else.
In other words, if you have:
-- removing the manifest entry from index.html and modifying the manifest (so it gets expired by the browser and all content reloaded) will not stop this page from behaving as if it's still fully cached. If you view source on index.html you won't see the manifest listed anymore, but the browser will still request only the cache.manifest file, and unless that file's content is changed, no other changes to any files will be shown to the user.
It seems like a pretty glaring bug, and it's present on iOS as well as Mac versions of Safari. Has anyone found a way of resetting the page and getting rid of the cache without requiring user intervention?
The manifest file is a simple text file that lists the resources the browser should cache for offline access. To learn more about how to create the manifest file, please read our HTML5 Application Cache chapter.
The CACHE section contains files you want to load and store on the user's machine. The first time the user loads your app, the browser will store all the files in the CACHE section of your app cache manifest. The NETWORK section contains all the resources that require a network connection to be loaded.
Yes you should cache your manifest. json file, because if you a building a PWA, then it must have a functionality to Add to home screen . In your manifest file, it contains a start_url that needs to be cached by service worker and should return a 200 response when offline.
A manifest file must be served with the mime-type text/cache-manifest .
Ive been researching the same question, and it doesnt appear to be an api to:
Here are the best resources I have found:
http://www.html5rocks.com/tutorials/appcache/beginner/
http://www.thecssninja.com/javascript/how-to-create-offline-webapps-on-the-iphone
In particular, this quote from the first link:
If the manifest file or a resource specified in it fails to download, the entire update fails. The browser will continue to use the old application cache in the event of such a failure.
Otherwise, there is no mention anywhere about unloading the cache.
Seems to suggest that you cant force an error to get it to uncache. However, as noted below, the spec suggests that if an error occurs while downloading the manifest file, the entire cache will be removed.
In google chrome, the user can go to the following URL:
chrome://appcache-internals/
And manually disable the cache. Of course, the next time they visit the page, it will be recached if the page has the manifest property set.
If you look at the specification:5.6 Offline Web applications
It seems to suggest a situation where the cache is removed. Specifically, section 5.6.4.5:
If fetching the manifest fails due to a 404 or 410 response or equivalent, then run these substeps: Mark cache group as obsolete. This cache group no longer exists for any purpose other than the processing of Document objects already associated with an application cache in the cache group. If cache group has an application cache whose completeness flag is incomplete, then discard that application cache.
It then says:
If this was a cache attempt, discard cache group altogether.
Basically, if the request for the cache manifest file results in a 404, then the entire cache should be discarded. So, have you tried to have the server return a 404 or 410 when the cache manifest file is requested? That should work. The trick is to only return the 404 / 410 for the pages you want to remove the manifest from (perhaps using url parameters?).
One possible solution:
Hardly elegant, but it seems to work. The main problem then is that you're stuck with this 404-generating false manifest entry until everyone who has ever been to your site has returned and had their cache cleared.
There has got to be a better way...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With