Xiaoqiang's HTML5 mobile development path (51) -- Improving page access speed in jquerymobile

Source: Internet
Author: User
Tags prefetch

When developing with jQuery Mobile, you can select single-page templates and multi-Page Templates. When using single-page templates, You need to request from the server when you jump from one page to another, the user will feel a slight pause. Using a multi-page template can improve the smoothness between page jumps. However, multiple pages must be downloaded at one time. Therefore, the download duration is longer and the user experience is also affected.

In the Development Based on prefetch technology, when the DOM object on the first page is loaded, jQuery Mobile performs prefetch on the link address marked with data-prefetch. The detailed process of prefetch is as follows:


Note: when using the prefetch function, we do not recommend that you add the data-prefetch attribute to all links. because too many data-prefetch attributes cause excessive pages to be prefetch by mobile devices, the loaded DOM object is too large, causing memory consumption on the mobile phone. Some Mobile Phones run slowly or even crash.

To effectively save memory resources of browsers on mobile devices, pages that are not marked with cache will be cleared when accessing the next page.


If you do not want to clear the cache of the previous page in the browser, you can add data-DOM-cache = "true" to the corresponding dom object. In fact, there is a better way, use the HTML5 Offline Application function to cache page content locally.

The 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.