Comments: When we use offline cache, resources, such as js, css, or image updates, may be updated. A problem arises: how can users update cache resources in a timely manner? The following describes the specific solutions in detail. For more information about similar cases, refer to. When using offline cache, resources, such as js, may be updated, css or image updates. However, the old version of the resource has been cached by the user before the update. During the next access, the user still uses the old version of the resource. How can the user promptly update the cache resource?
There are two main methods to update cache resources: modifying the version number of the configuration file or calling js to complete the update
Js update Method
The Code is as follows:
If (window. applicationCache. status = window. applicationCache. UPDATEREADY ){
Window. applicationCache. update ();}
Modify file
Update the manifest File
When the browser finds that the manifest file has changed, it obtains new resources for caching based on the new manifest file.
When the manifest file list does not change, we usually change the file by modifying the manifest comment to update the file.
Note change refers to the version number of the configuration file.