开发者

Cache manifest offline app not refreshing javascript files in Chrome

I am working on an offline web app using a cache manifest fi开发者_如何学Cle. I am having trouble refreshing my javascript files. If I change a .js file (which is listed in the manifest file) and I then change the manifest file version no. and save it, then the changed .js file does not get reloaded on the client. What do I have to do to get .js files to refresh?

Thanks


That's because the webserver tells the browser cache static files for a few hours. So the browser doesn't know the manifest file is changed. You can clear all the application data 'or' config the web server the manifest is not cacheable...

Read http://diveintohtml5.info/offline.html for more info

If you want to clear your app cache on chrome use chrome://appcache-internals/ and by hand you have to search in C:\Documents and Settings\YOURUSERNAME\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache


I had assumed that you if you use a cache manifest and then refresh the manifest, that the browser would request all of the files again. However, I have found that I needed to explicitly set headers in all of the files in the manifest to tell the browser not to cache the files. I believe that once the manifest tells the browser to request the file again, the browser treats it like any other non-manifest cached file. Maybe this is an error with Chrome, but I feel like I saw this in another WebKit browser.

Regardless, set the headers for the files in the manifest to never be cached and they should reload when you update the manifest. If these files are used outside of a manifest page, you may need to actually cache the files depending on your needs.


Type chrome://appcache-internals in your address bar then click ENTER

A list of cached manifests will appear then just delete the one you want and everything will be refreshed when you load your page again.

Hope this helps :)


I had the same problem until I came across this priceless warning on the Mozilla Developer site

Important: Do not specify the manifest itself in the cache manifest file, otherwise it will be nearly impossible to inform the browser a new manifest is available.

woops. my bad.

However, every time I change something in the code, I need to change something in the manifest, and then reload twice, which is an unrelated issue.


In my case, i has to disable the traditional browser cache using meta tags. See this SO question how to that

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜