Offline Web application Manifest and offline webmanifest
HTML5 adds the offline function.
Assume there is an online note application. When the user's mobile phone is disconnected, he may be editing a note.
Using the HTML5 offline Web application, you can edit the notes offline and send the local data to the server when the network is connected again.
The running mechanism of offline Web applications is to specify a text file with the suffix. manifest for each webpage that requires offline use.
This text file lists all the resource files (HTML, images, Javascript, etc.) required for offline use of the webpage ). Browsers that support offline Web Applications
The. manifest file is automatically read.
1. usage.
In the HTML start tag, we specify a. manifest file:
Note: The manifest attribute must be added to the HTML Tag of each page for offline use.
If the Apache server is used, you may need to modify the. htaccess file and append a line of code:
AddType text/cache-manifest .manifest
Now we need to fill in the offline. manifest content, that is, to notify the browser of Naxi, and the file is used for offline storage.
The content of the offline. manifest file is as follows:
CACHE MANIFEST#v1CACHE:basic_page_layout_ch4.htmlcss/main.cssimg/atwiNavBg.pngNETWORK:*FALLBACK://offline.html
2. What is included in the manifest file?
1) CACHE: Lists All files required for offline use. The paths of these files are relative to offline. manifest. You can also use an absolute path.
2) NETWORK: some files that do not need to be cached are listed. You can think of them as an "online whitelist". In this case, the files in the Luo column will directly skip the cache when the network is smooth.
If you want to update the network content in a timely manner when the network is smooth, you can use it here *. The asterisk is used as a wildcard in the online white list.
3) FALLBACK: a URL template is partially defined using/characters. Its function is to access each page and ask "Is there a page in the cache? "If yes, the cache page is displayed. If no
The specified offline.html file is displayed.