HTML5 offline Cache usage

Source: Internet
Author: User

HTML5 offline cache usage and considerations

1, add the index.html to the offline cache declaration file, such as:
<! DOCTYPE html>

Test.appcache and index.html are under the same path.

2. Add the MIME type declaration to the server side:
Tomcat joins in the following Web. xml
<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>

3. Writing Test.appcache files
CACHE MANIFEST
# 2016-04-26
#v1.0.9

CACHE:
Css/my.css
Js/my.js

NETWORK:
*
FALLBACK:
/html5//404.html
The first line must be cache MANIFEST
Cache: Configuring files to be cached cannot use wildcard characters
NETWORK: Configure files that are not cached, you can use wildcards to indicate that no other files are cached
FALLBACK: Specifies the fallback page when the page is inaccessible

4. You can update the cache file by changing the comments in the Test.appcache, such as the version number, the second time the page is opened with a new file

5. When index.html is also cached, the cache file can be updated by changing the Test.appcache file name.

HTML5 offline Cache usage

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.