Comment: When we use offline cache, we may sometimes update resources, such as js, css or image updates. A problem arises: how can users update cache resources in a timely manner? The following will introduce the specific solutions in detail. If you have similar situations, please refer to it.
When we use offline cache, we may sometimes update resources, such as js, css or image updates. However, before the user has cached the old version of resources, and when the second visit is used, how can the user update the cache resources in time?There are two main ways to update cache resources: by modifying the version number of the configuration file or calling js to complete the update.
js update method
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
window.applicationCache.update(); }
Modify the file
Update manifest file
When the browser finds that the manifest file itself has changed, it will obtain new resources based on the new manifest file for cache.
When the manifest file list has not changed, we usually change the file by modifying the manifest annotation to achieve update.
Comment changes refer to the version number of the configuration file