HTML5 - cache manifest working great on Chrome but not on Firefox and Opera

后端 未结 13 1351
挽巷
挽巷 2020-12-15 17:55

I am developing a web app for offline use, thus I need to use the application cache functionality.

Everything works great on Chrome (15.0.874.106) but is doesn\'t wo

13条回答
  •  长情又很酷
    2020-12-15 18:20

    You can check the current status of the application cache using window.applicationCache.status, which returns a numeric value mapped to the following states: 0 - uncached, 1 - idle, 2 - checking, 3 - downloading, 4 - updateready, 5 - obsolete.

    The application cache API has a few things worth noting: window.applicationCache.update(): This will trigger the application cache download process, which is nearly the same as reloading the page. It simply checks if the manifest has changed, and if so downloads a fresh version of all the content in the cache (respecting any cache headers). Note that even though a new cache is created with this, the page will continue to use the old cache. To make the page use the new cache you have just downloaded, you must use the swapCache() function.

    window.applicationCache.swapCache(): This function tells the browser to start using the new cache data if it is available. It is important to note that even if there is a new manifest file, the application will still continue using the old cache (as specified in the old manifest file) untill swapCache() is called. Once swapCache() is called, then the cache will be used as specified from the new manifest file.

    from: http://dev.opera.com/articles/view/offline-applications-html5-appcache/

提交回复
热议问题