HTML5 offline storage, application Cache,manifest use experience

Source: Internet
Author: User
Tags browser cache

Recently added a forum module in the APP, in order to complete quickly, decided to make the entire forum module WEB app,web APP The most deadly is the user experience problem, page jump and too many requests, greatly affected the loading speed and user experience, this time I think of HTML5 offline storage. After a simple understanding, I think this can be, but soon I found that HTML5 offline storage is not suitable for this project. The reasons are as follows: 1. Once the page has been assigned a manifest, the page must be stored. If there is a dynamic page, do not want to cache the contents of the page, just want to cache the page refers to the css,js,img, but sorry, there is no way to do it. I think it is because the browser and server established interaction logic that must be designed to do so, otherwise I would not understand the designers. 2, page.html?id=1 and page.html?id=2 are stored as two HTML different pages, think of when the user browsed 1000 different posts, the browser downloaded stored 1000 meaningless pages. 3, the first time to access Page.html?id=1, after the successful cache. Again access page.html?id=2, will not read the cache, because the parameter is changed, is considered to be different, not a second request, so the request page.html?id=2 will still reload manifest the specified file. 4, and I in order to quickly complete, in and out of the hierarchy have made a page jump, inevitably pass a lot of parameters, and each post is not the same ID, so in this case the offline cache is basically meaningless, because a large number of requests belong to the first visit. 5, again, according to the information on the Internet, the offline storage will be downloaded once the corresponding data, meaning that, the first time access, the use of offline storage technology page loading time than the use of this technology is more than the page, and consumption of more traffic. Therefore, manifest is extremely unsuitable for use with dynamic parameter page jumps, preferably a page, and then a full Ajax request. Additional information: http://www.cnblogs.com/svage/archive/2011/11/24/2261365.html HTML5 offline application application Cache one, application scenario We typically use the browser cache to store Web pages on a user's disk, saving bandwidth when the user browses again, but even then, the web cannot be accessed without the Internet. In order for the Web application to be accessed offline. The HTML5 provides offline storage functionality through the application cache API. The premise is that the Web page you need to visit has been visited at least once online. Offline thisWhat is the difference between the storage and the traditional browser cache? 1, the browser cache mainly consists of two categories: a. Cache negotiation: The Last-modified,etag browser asks the server if the page has been modified, and if it returns 304 without modification, the browser browses to the local cache file directly. Otherwise the server returns new content. B. Thorough caching: Cache-control,expires sets the cache expiration time through Expires and does not need to interact with the server request before it expires. 2, offline storage for the entire Web service, browser cache cache only a single page; 3, offline storage can specify the files that need to be cached and which files can only be browsed online, browser cache cannot be specified; 4, offline storage can dynamically notify users to update. Second, how to realize the offline storage is managed through the manifest file, need server-side support, different server open support way is also different. Copy Code CACHE manifest//must start with this version 1.0//The best definition versions, the update only need to modify the version number Cache:m.png test.js test.css NETWORK: * FALLBACK online.ht ML offline.html Copy Code cache specifies files that need to be cached, network specifies files that are only browsed through the network, * represents files in addition to the cache, fallback each line specifies the files to be used online and offline, respectively To have manifest manage the store, you also need to define the manifest attribute in the HTML tag, as follows: Copy code DOCTYPE html>

HTML5 offline storage, application Cache,manifest use experience

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.