Getting Started with JQuery Mobile-page Caching

Source: Internet
Author: User
Tags min

1. In jquery Mobile, the historical content accessed through the page cache can be written to the cache of the page document, and when the user re-accesses it, it does not need to be reloaded, as long as it is read from the cache.

2. To set the page to be cached, simply add the Data-dom-cache property to the page container and set the property to True. There is another way to set up a cache page in jquery Mobile, which is to set a global jquery Mobile property value to true with JavaScript code such as $. Mobile.page.prototype.options.domcache=true

3. Sample code:

<! DOCTYPE HTML >
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "viewport" content= "width=device-width,initial-scale=1"/>
<link href= "Css/jquery.mobile-1.2.0.min.css" rel= "Stylesheet" type= "Text/css"/>
<script src= "js/jquery-1.8.3.min.js" type "Text/javascript" ></script>
<script src= "Js/jquery.mobile-1.2.0.min.js" type= "Text/javascript" ></script>
</HEAD>
<BODY>
<div data-role= "page" data-dom-cache= "true" >
<div data-role= "header" ><div data-role= "Content" >
<p> This is a cached page </a></p>
</div>
<div data-role= "Footer" ></div>
</BODY>
</HTML>


4. Preview of Effect diagram:



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.