2

I am working with jqmobile and phonegap. While developing mobile web applications is normally recommended to use the multipage technique, that is, put different pages inside the same .html file so that the transitions go faster. However, as long as I´m using phonegap (so every html file is contained in the apk LOCALLY in each mobile phone), is it also recommended to use multipage technique? Is it faster to put more than one file inside the same .html using jqmobile with phonegap?

Regards,

alvaro.rmfg
  • 379
  • 3
  • 15

1 Answers1

4

In my honest opinion, jQuery Mobile is not the best tool to use in PhoneGap based apps. jQM is dependent on jQuery which contains a lot of code that is not really required when you are building a mobile app. There is code in there that supports IE and Firefox but since the big three mobile phone OS'es (iOS, Android, BB) are all WebKit based it is just over kill.

However, if I was going to use jQM in my PG app I would use a single page approach if at all possible. This will prevent a couple of common issues that people see when using jQM/PG. For instance when you navigate to a second page the transitions are not always great on the mobile device, they are particularly bad on Android. As well when you app moves to page two it has to reload jQuery, jQuery Mobile and PhoneGap and this takes time. So if you can fit everything into one page by doing show/hide div's it would be better performance wise. If you need to go to a second page look at loading it via AJAX into the current pages DOM.

Also if you are on Android you may want to disable some CSS to get things to run smoother.

https://stackoverflow.com/a/8212384/41679

Community
  • 1
  • 1
Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74
  • 1
    Thanks, I will take into account your advices. BTW, if you don´t recommend to use jquery mobile, what would you recommend? Zepto maybe? – alvaro.rmfg Sep 25 '12 at 14:23
  • It all depends on what UI elements you need sometimes it makes sense to write it yourself but other times you would use Dojo Mobile, Sencha Touch, Kendo UI, Zepto, jQuery Mobile – Simon MacDonald Sep 25 '12 at 23:03
  • I just began to read up on this, and as I understand it, jQuery Mobile does not load multiple times, and handles the loading with Ajax as part of the basic features of the library. http://jquerymobile.com/demos/1.2.0/docs/pages/page-links.html – Niklas Wulff Oct 04 '12 at 19:03
  • It depends on if your setup jQM to be a single page or multi page app. – Simon MacDonald Oct 05 '12 at 16:35