O'Reilly logo

jQuery Mobile Cookbook by Chetan K Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the DOM cache to improve performance

During page navigation in a single-page template application, each new page is fetched and stored in the DOM. The page remains in the DOM and is removed once you navigate away from the page. Only the main or the first page of the app always remains in the DOM. As seen in the previous recipe, prefetching commonly-used pages could help in improving performance to some extent. But when you visit a prefetched page and navigate away from it, the page gets removed from the cache. So the problem of multiple fetching of frequently visited pages is not fully solved.

With DOM caching, specific pages are marked to be cached in the DOM. These pages, once loaded, remain in the DOM all through the life cycle of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required