开发者

How can I get rid of the HTML5 offline cache?

开发者 https://www.devze.com 2023-02-22 04:11 出处:网络
I have an application which used to use the HTML5 offline cache. Now I\'ve decided to not use it anymore and removed the manifest attri开发者_如何学JAVAbute from the index.html file. However, browsers

I have an application which used to use the HTML5 offline cache. Now I've decided to not use it anymore and removed the manifest attri开发者_如何学JAVAbute from the index.html file. However, browsers still regard this site as cached and refuse to update the index.html file.

Even updating the manifest doesn't help. How can I remove the site from the user's offline caches? Am I stuck with a cached web site forever?


You need to make sure the manifest file isn't being cached, which by default it will be.

Adding

ExpiresActive On
ExpiresDefault "access"

To your .htaccess will stop everything being cached, though you really just want the manifest file to be cached in this way like this: (remember to update filename)

<Files cache.manifest>
    ExpiresActive On
    ExpiresDefault "access"
</Files>

You really need to do that first, but this should alleviate the problem.

I'd recommend reading through Mark Pilgrim's page on this as well.


Try changing contents of your manifest to simply CACHE MANIFEST with no files listed. The clients should retrieve the new manifest next time they hit the site and their cache should be removed.

Note however that they won't be using this new, empty manifest until they refresh the page.

I've found that in some cases on some browsers they don't necessarily grab the new manifest right away. This behavior seems inconsistent though. When this happens I tend to clear their caches / offline storage manually in order to force them to update (though I understand you can't necessarily get users to do this).

0

精彩评论

暂无评论...
验证码 换一张
取 消