Html5 Tutorials: Implement html5 Offline Application Development

Source: Internet
Author: User

How to Implement html5 offline applications ?, For many friends, it may not be very clear about how to develop html5 offline applications. The following section will help you develop html5 offline applications! A friend in need has seen it!

Html5 Offline Application Implementation Method:

The description of html5 offline applications is not mentioned here. Google or Baidu is required. This article aims to introduce how to develop offline applications;

Step 2: Create a manifest file and specify a list of cached files;

You can create a file with the suffix of txt text. The first line must be written to the cache manifest;

In the second line, you can write an optional description # version 1.0, which starts with #. Here, it indicates the version number;

At the beginning of the third line, each line has a file path relative to the current file directory, for example:

Static/img/logo.png

Static/css/style.css

You can write a basic manifest file and change the file suffix to. manifest;

Step 2: Specify the file manifest attribute in the html file as the path of the cache. mnifest file;

After the manifest attribute is added, the page is loaded. The files in the cached configuration file will be cached offline and will not be read from the server when the configuration file is refreshed again;

Step 2: refresh the cache through the API interface;

Use JS through window. applicationCache is used to obtain offline cache objects, and the update method is called: window. applicationCache. update () to call the download of the current cache file. After the download is complete, the updateready event of the offline cache object is triggered. The swapCache method is executed by binding the event to clear the cache: window. applicationCache. swapCache (), this will not cause the previously loaded resources to be suddenly reloaded, but the resources on the requested page will be updated afterwards;

The above is the method for implementing HTML5 offline applications. Please try it!

You still like the following:

Large inventory of HTML5 development tools: 10 models should be evaluated

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.