jQuery Mobile single-page vs multi-page template
Single Page Template:
Launch - example from previous post, notice the address shown as you navigate
Lighter and cleaner. Each page is a separate html file and more modular.
Better fallback if JavaScript is not supported. So works well on more platforms, you could even target grade C browsers
On first load, the start page is loaded into the DOM. An internal reference is always held to this. Any new page loaded is added to the DOM. Any previously shown page is removed from the DOM. The start page is always in the DOM.
The DOM size is relatively smaller
Optional to use the "page" data-role element in the code
Can turn off Ajax Navigation between pages using data-ajax="false"
Recommend to use the tag for page titles
The tag always gets precedence during page loads
Consumes more bandwidth as each page navigation generates a new request
Navigating back to a previously loaded page will again generate a fresh request (with DOM caching you can avoid reloading of the same pages multiple times)
First load is faster, but every subsequent page has to be fetched
Suitable for larger applications and situations where you want to target as many platforms as possible including platforms which lack JavaScript support
Multi Page Template:
Launch - example from previous post, notice the address shown as you navigate
Heavier. All the pages are in a single html file.
Needs JavaScript support as Ajax Navigation is used
Multiple page containers are present, and only the first one is shown when page loads
Large applications with many pages will increase the DOM size
The "page" data-role element is required
Using data-ajax="false" for internal pages ignores the data-transition attribute, by default slide is used
Recommend to use the data-title attribute for all page titles
On first load, tag is used and subsequent transitions data-title is used for page titles
Since all pages are already loaded, no additional requests are generated for navigating between pages
First load is slower as the file size is larger, but subsequent page navigation is fast
Suitable for relatively smaller applications and situations where you know the capabilities of your target platforms including presence of JavaScript support
No comments:
Post a Comment