Question

I have an have an html5 offline app. I am using the cache.manifest file to trigger client code refreshes. There are several javascript files in the app which are listed in the manifest. Whenever an offline app update is triggered (via the manifest changing) I write the cache download events to the console log. This allows me to see which files are being downloaded/refreshed. Whenever I change the manifest file then I correctly observe a download entry for all javascript files listed in the manifest.

So far, so good.

Most of the javascript files get refreshed. I can see them by loading Chrome's developer tools window (CTRL+ALT+I) and looking at resources->scripts. Changes are present.

However, one file seems to cause a problem. It is listed as being downloaded, but when I view the script contents then it has not been refreshed. There are no manifest errors, and the whole manifest download and cache refresh operation completes without error. But, this one file refuses to be refreshed.

Anyone know what's happening, and how to fix it?

Was it helpful?

Solution

The best way around this problem is to version the .js files by adding a url parameter e.g. /Scripts/sample.js?v=1.0.24

To avoid any caching issues then simply increase the version number when you make a change to the .js file.

OTHER TIPS

I've used the code with adding event listener from HTML5 Rocks tutorial and it now loads all changes to js or css I make.

Now the browser is always asking server if the file has changed.

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