Small strong HTML5 Mobile Development Road (Wuyi)--jquerymobile improve page access speed

Source: Internet
Author: User
Tags prefetch browser cache

When using jquery Mobile for development, you can choose a single-page template and a multi-page template, when you use a single-page template to jump from one page to another page when you need to request from the server, the user will feel a slight pause. With multi-page templates, you can improve the smoothness of page jumps, but multiple pages are downloaded at once, so the download time becomes longer and the user experience is affected.

In the development of prefetch-based technology, when the first page's Dom object is loaded, JQuery Mobile will prefetch the linked address of the tag data-prefetch. The detailed procedure for prefetching is as follows:


Note: When using prefetch, it is not recommended to add the Data-prefetch property to all links, because too many Data-prefetch properties cause the mobile device to prefetch too many pages, loading DOM objects too large, causing phone memory consumption, some phones running slowly or even crashing.

In order to effectively save the memory resources of the mobile device browser, the page without tag cache will be cleared when the next page is accessed.


If you do not want to clean up the previous page in the browser cache, you can add Data-dom-cache= "true" on the corresponding DOM object, there is a better way to use the HTML5 offline application function to cache the content of the page locally.

The relevant sample code is as follows:

<! DOCTYPE html>Prefetchpage01.html

<section id= "page_pagetransition2" data-role= "page" >
Prefetchpage02.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.