HTML5 cache

1. Declare the cache in the html/htm file. The declaration method is as follows:

1 <!DOCTYPE HTML>
2 <html manifest="demo.appcache">
...
3 </html>

2. The pages that need to be cached are directly specified in the manifest file

Please note : The suggested file extension for the manifest file is: ".appcache".

The manifest file needs to be configured with the correct MIME-type, which is "text/cache-manifest". It must be configured on the web server.

CACHE MANIFEST #CACHE MANIFEST - files listed under this heading will be cached after the first download
# 2018-05-2 v1.0.0
/theme.css
/logo.gif
/main.js

NETWORK:#NETWORK - files listed under this heading require a connection to the server and will not be cached
login.asp

FALLBACK:#FALLBACK - The files listed under this heading specify fallback pages (such as 404 pages) when the page is unreachable
/ html5 //404.html

 three,

Once an application is cached, it remains cached until:

  • User clears browser cache
  • The manifest file is modified (see tips below)
  • Updating the app cache by the program

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325159449&siteId=291194637