[Original] HTML 5 Application Cache Usage Summary

Source: Internet
Author: User

Recently, I was exposed to the HTML5 local cache and added the. appcache file to the HTML tag on the HTML page. This allows you to easily create offline web applications.

Benefits of using local cache:

    • Offline browsing-users can use them when the application is offline
    • Speed-cached resources are loaded faster
    • Server Load Reduction-the browser will only download updated or changed resources from the server.

Browser support:

All mainstream browsers support applicationsProgramCache, except for IE

HTML5 cache manifest instance

The following example shows the HTML document with cache manifest (for offline browsing ):

HTML page

Demo. appcache File

Cache manifest Basics

To enable application caching, include the manifest attribute in the <HTML> tag of the document:

<! Doctype HTML> <HTML manifest = "demo. appcache">...  

Each page with a specified manifest is cached when the user accesses it. If the manifest attribute is not specified, the page is not cached (unless the page is specified in the manifest file ).

The recommended file extension for the manifest file is: ". appcache ".

Note that the manifest file must be configured with the correct mime-type, that is, "text/cache-manifest ". Must be configured on the Web server.

Manifest File

A manifest file is a simple text file that informs the browser of cached content (and non-cached content ).

The manifest file can be divided into three parts:

    • Cache manifest-files listed under this title will be cached after the first download
    • Network-the files listed under this title need to be connected to the server and will not be cached
    • Fallback-the files listed under this title specify the rollback page when the page cannot be accessed (such as the 404 page)

Manifest usage summary:

    • After the. appcache file is added to the HTML page, files can be cached offline on both PC and mobile browsers.
    • Pages added with. appcache will also be cached.
    • If you modifyTimestampFile, but does not modify the. appcache file, you cannot update the browser cache file
    • After the. appcache file is introduced to the HTML page, the cache file can be updated only when the. appcache file is modified.


With the. appcache file, does the HTML timestamp file lose its original meaning?

Maybe when I see Marx in earlier ie versions and all browsers support HTML5 application caching, the HTML timestamp file may retire. At least currently, it is still inseparable from the time stamp file of ordinary updates. The. appcache file is used to update the browser cache. Currently, it is mainly used on mobile terminals.





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.