Question

I setup an Application Cache on a site and shortly thereafter realized its way more aggressive that I realized. I want to remove it. Permanently.

I've read that passing a changed manifest file, completely empty, with the correct MIMETYPE will remove the cache. Edit: See below. Maurice's answer is the only consistent fix.

Is this the fastest, most effective solution? Is there a better way?

And if you can specify whether or not you've actually used this functionality before with your answer I'd really appreciate it - ambiguous documentation and quirky that didn't show during testing are what got me into this situation.

Was it helpful?

Solution

The trick is to first change the manifest URL in your HTML page to something invalid so the browser will receive a 404 when loading it. Make sure to also change the original manifest otherwise the new HTML page is never downloaded. After the browser has failed to download the new manifest URL you can completely remove the manifest setting from the HTML page.

Kind of wacky but that seems to be the only reliable way of removing an existing manifest reference.

OTHER TIPS

As of 6/25/2015 I found returning a 404 will not clear the existing appcache for Firefox, and returning a blank appcache will not clear the existing appcache for Chrome. Returning the following appcache seemed to work in IE,Chrome,Safari, and Firefox, although it is unclear by what mechanism the disabling of 'implicit' caching of index.html is accomplished.

NETWORK:
*

CACHE:
FALLBACK:

I've been having a similar issue where I needed to reset the appcache after a failed update (i.e. force a complete removal of the appcache so that it can be re-built from scratch).

Building on Maurice's answer I present the user with a normally hidden link that opens a non-cached page, which just writes a cookie and returns the user to the previous view. This cookie tells the server to return a 404 the next time the appcache is requested, and the user is then taken through the normal login process. When the application next successfully runs it clears the cookie and caching resumes as normal.

Using a cookie in this way gets around issues where the master version of the view is stuck in the appcache, making it difficult to inject a breaking url into manifest="" i.e. the manifest url stays the same, but the server responds with a 404 until told otherwise.

If you just want it removed from your side you can do that from the Browser. I can only remember how to do it in Chrome. Go to chrome://appcache-internals/ & remove desired file(s). You can also clear cache & cookies & that should work. I've only testing that in Chrome, however.

If you want to remove it for all viewers, I know of no way to detect if they have an old cached version, but I know that keeping the attribute with a false link, like Maurice suggested, would be the only way that I would know; though, I'm sure there is another way, most likely with jQuery.

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