HTML5 using Applicationcache

Source: Internet
Author: User

Using the application cache in HTML5 can save some static resources on the client's browser. This can increase the speed of access, even offline applications. About the pros and cons of application cache:
1. Offline Browsing-users can browse your entire website while offline
2. Speed-cache resources are local resources, so load faster
3. Less server load-the browser will only download resources from the server that has changed
[Reference Article] (http://www.html5rocks.com/zh/tutorials/appcache/beginner/)

Manifest

Using AppCache we need to maintain a list. The name of the file to go, but the suffix has provisions. AppCache then reference on the HTML tag

The document is divided into 4 parts
CACHE MANIFEST
The files here will be cached in the client
NETWORK
The files here are not cached in the client
FALLBACK
Here is a replacement resource that automatically uses resources when access to resources fails

Example

CACHE MANIFEST
Site.css

NETWORK:

FALLBACK:

Some pits
The above, in fact, there is not much value, are other places to move over. If you think that installing the above steps will be able to happy the use of AppCache, then it is wrong.
Mime
Using AppCache requires you to configure MIME on the server. Otherwise, the client cannot read the. appcache list file.
If you use VS to debug, you need to change the configuration file for IIS Express.
C:\Users\username\Documents\IISExpress\config\applicationhost.config
Open this configuration file and locate the MimeMap configuration node to add a node.
<mimemap fileextension= ". AppCache" mimetype= "Text/cache-manifest"/>
NETWORK
As stated above, this node specifies a resource that is not cached. If you do not fill in, there are a lot of resources to download not down. You have to do this:
NETWORK:
*
Write the * wildcard and tell the client that other resources are not cached except for the cache list above.

  Remove AppCache

When you don't want to AppCache, you think you just have to remove the manifest of the HTML tag and you're wrong. You want to remove the. AppCache list file from the server. This will really remove the AppCache functionality.

HTML5 using Applicationcache

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.