Comments: To use this api, make sure that the corresponding mime type is configured on the server side. Take tomcat as an example to describe it in detail, if you want to use this api, you must ensure that the corresponding mime type is configured on the server.
Take tomcat as an example. Open the Tomcat 6.0 \ conf \ web. xml file and add the following content at the end of the file:
The Code is as follows:
<Mime-mapping>
<Extension> manifest </extension>
<Mime-type> text/cache-manifest </mime-type>
</Mime-mapping>
Note that the value of extension is manifest, so the suffix of the cached file must be the same as that of the file.
The cache format must be as follows:
The Code is as follows:
<! DOCTYPE html>
<Html manifest = "/cache. manifest">
<Body>
...
</Body>
</Html>
Cache. mainfest is the file configured on the server.
The format is as follows:
The Code is as follows:
CACHE MANIFEST
Index.html
Time. js
Time.css
# Fallback is mainly used to replace files offline,
# All requests under/pay/ofline.html pay are forwarded to ofline.htm offline.
FALLBACK:
Server-time.js fallback-server-time.js
NETWORK:
*
# Version 9
The version is the version label. When the version changes, the client automatically updates the cache.