In
this article I have read, its stating that it should be a bad practicee because it will use more loading time for each transition.
Lars, the author of that article has used some confusing terminology. The JQM documentation is at least consistent if, admittedly, confusing:
- Multi-page (or "multi-page template") - A single document which contain multiple pages. If you use this, this single document should normally contain your *entire* site or app.
- Single-page (or "single page template") - Multiple documents, each of which contain a single page. jQuery Mobile manages the loading/unloading of pages in the DOM. As the user navigates the site, JQM loads pages from the server, and then removes them when they are no longer needed.
The author of that article uses slightly different terms:
- Multi HTML Page Template (same as what JQM docs call "single page template")
- Multipage template (same as JQM "multi page template")
The terminology in the docs is a poor choice to start with, and must be terribly confusing especially for non-native English speakers. There is also confusion over "page" vs "document", where "document" has a very precise meaning in HTML that is often missed. I can easily see readers thinking that "multi-page template" means that you have several HTML documents comprising the site, when it is the opposite.
Other than the terminology confusion, the article is fairly accurate. I would agree with most of the plusses and minuses.However, there are some "bads" disguised as "goods". This is listed as a "good" for "multipage template":
Suitable for relatively smaller applications and situations where
you know the capabilities of your target platforms including presence of
JavaScript support, thus making it a great solution
What is left out here is that the word "only" should be added:
Suitable only for relatively smaller application
A 50-page application is not a "smaller application"
This deserves a bullet point in the "bad" list.
-----
I've seen a lot of fallacious arguments in favor of multi-page templates arguing the advantage of not having to load from the server for every page change. What they ignore is that you can have your cake and eat it too using single-page templates.
data-dom-cache and
data-prefetch allow you to retain pages in the DOM after the user has left the page, as well as to pre-load pages that the user might likely transition to in the future. They allow you to do exactly what many developers are attempting to do by mixing single-page and multi-page templates, but do so in a much more elegant and less troublesome way.
(The very slight difference between this and multi-page is that if you use
data-prefetch, the pages will be fetched in multiple HTTP requests, rather than one. But I can only see this as a plus in a mobile environment - its a win-win, because the first page is seen sooner. Nobody is going to wait for 50 pages to download in one document. You will lose your user right on the home page.)
I'll reiterate that the vast majority of
successful JQM sites/apps use a single-page template.