I am of the opinion that multi-page documents should almost never be used in jQuery Mobile. Yet, multi-page documents, and ways to "fix" multi-page document linkage to other pages seems to be an ongoing issue with a high level of activity on this forum.
I'd like to keep any discussion of "why" separate. If you are curious, you can find plenty of discussion on that topic elsewhere in this forum.
I am curious, though, as to exactly why so many developers seem to be using multi-page documents. It's not something that is overly-emphasized or pushed in the documentation. I wouldn't come away from the docs thinking "I really ought to use multi-page documents". In fact, a close read would suggest it's a bad idea, unless you are developing a really, really small site. The usage of multi-page documents seems way out of proportion to their intended use or their treatment in the documentation.
I am guessing that developers are getting some bad advice from somewhere. And I'd like to find out where.
I might be wrong, and it's simply a case of developers using the feature "because it is there" or "because it sounded cool".
Please be as specific as possible. If you developed a site, or part of a site, using a multi-page document (or multi-page documents), where did you get the idea that you should do that? Was the something in particular that you read in the docs? A sample or tutorial? When did the lightbulb first come on, "I ought to use a multi-page document"?
I'd go with "because it is there" and it allows for a quick way to test a concept or create an example. Those concepts or examples then grow into a real project where they really should have been separate files, but stayed a single file.
I will second "because it is there". You see a documented option/feature and you start envisioning ways that it can help you craft things.
The first few JQM web apps I did were single page. All of my apps are very dynamic and data driven. I develop with MVC so my views (pages) are interacting with my model. I saw the multi-page template as a good tool for displaying a dynamically injected dialog to obtain data for a field or fields in my model. The dialog contains a form that is handled by the same controller logic as the remainder of the page. Simplifies things.
I've also thought it would be good for creating dynamic "pages". For instance I have a TV Network mobile site. There are different shows on the network. Each show has different episodes. I thought that I could use the multi-page template to inject dynamic pages for each episode in order to provide a carousel of sorts that allows a user to thumb through the episodes.
I am discovering that the side effects of the multi-page template at this time make it more of a pain than it is worth. But you asked about why, so there is my why.
I found out about multi-page technique from the jqm doc site itself and it made sense to me. I find that it's easier to read and organize when it's multiple page template( infact I have my pages spread out in multiple .html files ), especially when I have pages that get more complicated.
However, I have to use the subpage widget in order to have jqm load pages from external html files but it's really not that big of a hassle as you'd probably think( just nest inner pages w/ data-role='subpage' or 'subpage-dialog' and it just works).
I realize having to depend on a 3rd party plugin isn't the best practice but the benefit of being able to organize my pages in different html files outweighs including an extra js file(though very small, 5kb).
Hello, I'll give you an scenario where I find it useful to use multi-pages documents. We already have a web application which is heavily based on request/response page reload where the rendering is done server side. (classic struts2 web application). This means no REST, no JSON.
We have to render a JQM single page for every request. With multi-page documents we have the opportunity to render multiple pages for one request-response server round-trip.
I think I got the idea also from the documentation (Multi-page template structure) and some tools that support this way of working. For example in my snippet library (in Sublime Text 2) for JQM there is a "basic semantic page" which pops in a page without <head> etc. In the beginning I also worked a bit with Dreamweaver which might have had this multi page template for mobile projects.
Most of my projects are really small (5 pages or so) and in that case it is quite nice to have one file where everything is in that file.
Not sure if it eventually is a speed benefit as well (less http requests). That is only true if most people visit most of my pages of course.
Hmmm - maybe you are right. On second thought it would probably be quicker to load only page 1 first. I will start experimenting with this. Thanks
Leave a comment on emetselaar's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic