HTML5 offline applications

Source: Internet
Author: User
Tags sessionstorage

Brief Introduction: Web2.0 technology encourages personal participation. Everyone is a Web content writer. If the Web application can provide offline functions and allow users to write content in areas without a network (such as aircraft) or when the network is broken, wait until there is a network, and then synchronize to the Web, which greatly facilitates the user's use. HTML5, as a new generation of HTML standards, includes support for offline functions. This article describes the offline HTML5 functions, such as offline resource caching, online status detection, and local data storage. It also illustrates how to use the new HTML5 features to develop offline applications. Introduction to HTML5 offline functions HTML5 is a new generation of HTML standards currently under discussion. It represents the latest development direction in the Web field. In the HTML5 standard, new and diverse content description tags are added to directly support functions such as form verification, video and audio tags, drag and drop of webpage elements, offline storage, and working threads. One of the new features is the support for Offline Application Development. When developing a Web application that supports offline processing, developers usually need to use the following three features: offline resource cache: you need to specify the resource files required for the application to work offline. In this way, the browser can cache these files locally when they are online. After that, when the user accesses the application offline, these resource files are automatically loaded, so that the user can use them normally. In HTML5, the cache manifest file is used to specify the resources to be cached, and automatic and manual cache update methods are supported. Online status detection: developers need to know whether the browser is online so that they can handle the online or offline status. In HTML5, two methods are provided to check whether the current network is online. Local Data Storage: When offline, you must be able to store data locally to synchronize data online to the server. To meet different Storage requirements, HTML5 provides two Storage mechanisms: DOM Storage and Web SQL Database. The former provides easy-to-use key/value pairs, while the latter provides basic relational database storage functions. Although HTML5 is still in the draft State, many functions have been implemented by mainstream browsers. The latest versions of Chrome, Firefox, Safari, and Opera all provide complete support for HTML5 offline functions. IE8 also supports online status detection and DOM Storage. The following describes the offline HTML5 functions, including offline resource caching, online status detection, DOM Storage, and Web SQL Database. Finally, a simple Web program is used to describe how to develop offline applications using HTML5. Offline resource cache in order to allow users to continue accessing Web applications offline, developers need to provide a cache manifest file. This file lists all resources that need to be used offline. the browser will cache these resources locally. This section uses an example to demonstrate the purpose of the cache manifest file, describe its writing method in detail, and finally describe the cache update method. The cache manifest example is described through the W3C example. Clock Web applications are composed of three files named clock.html?"“clock.css "and" clock. js. Listing 1. Copy the Clock application Code XML/HTML Code to the clipboard <! -- Clock.html --> <! Doctype html>

Related Article

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.