When we use offline cache, we may sometimes update resources, such as js, css or image updates. But before the update, the user has cached the old version of the resource. When he accesses it again, he is still using the old version of the resource. How can the user update the cached resource in a timely manner?
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 the manifest file The browser finds that the manifest file itself has changed, and it will update the manifest file according to the new manifest file To obtain new resources for caching.
When the manifest file list does not change, we usually change the file by modifying the manifest comment to achieve the update.
The comment change refers to the version number of the configuration file
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn