andreapier
andreapier

Reputation: 2958

Loading all pages at startup jQueryMobile

is there any way to load all pages when i enter my site and display only the first one?
I'm creating a web app with lots of images so if i could load the entire app i would have a big performance improvement during normal usage... my users can wait a bit longer when first entering the webapp.
Thanks

Upvotes: 2

Views: 3284

Answers (2)

sgliser
sgliser

Reputation: 2071

For the pages themselves, you can use use the multipage templates as noted by Jasper.

However, this will not necessarily pull in all the assets and cache them. You may want to enable offline caching for certain assets that are frequently used. There is something like a 5mb total limit on devices so use it wisely. Doing this will keep it cached so that the next time your launch the site, all those pieces are INSTANTLY available.

http://developer.apple.com/library/safari/#documentation/iPhone/Conceptual/SafariJSDatabaseGuide/OfflineApplicationCache/OfflineApplicationCache.html

Upvotes: 1

Jasper
Jasper

Reputation: 76003

You can use a multi-page template to load all HTML on the initial load (look at the source of the following page in the jQuery Mobile Documentation, there are several data-role="page" elements in the same HTML document): http://jquerymobile.com/demos/1.0rc2/docs/pages/multipage-template.html.

You can also pre-fetch pages by setting the data-dom-cache attribute to true (jQuery Mobile will pre-load the flagged links so they will be ready to view when the user clicks the link to view them): http://jquerymobile.com/demos/1.0rc2/docs/pages/page-cache.html

Upvotes: 4

Related Questions