Offline Web application Manifest and offline webmanifest

Source: Internet
Author: User

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.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.