HTML5 offline cache usage and considerations
1, add the index.html to the offline cache declaration file, such as:
<! DOCTYPE html>
Test.appcache and index.html are under the same path.
2. Add the MIME type declaration to the server side:
Tomcat joins in the following Web. xml
<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>
3. Writing Test.appcache files
CACHE MANIFEST
# 2016-04-26
#v1.0.9
CACHE:
Css/my.css
Js/my.js
NETWORK:
*
FALLBACK:
/html5//404.html
The first line must be cache MANIFEST
Cache: Configuring files to be cached cannot use wildcard characters
NETWORK: Configure files that are not cached, you can use wildcards to indicate that no other files are cached
FALLBACK: Specifies the fallback page when the page is inaccessible
4. You can update the cache file by changing the comments in the Test.appcache, such as the version number, the second time the page is opened with a new file
5. When index.html is also cached, the cache file can be updated by changing the Test.appcache file name.
HTML5 offline Cache usage