Hybrid Apps using Cordova/PhoneGap: Ditch JQuery Mobile
I had a very difficult experience with JQuery Mobile & don’t recommend it to anyone due to reasons outlined below. Basically JQuery Mobile is only suitable for a rapid fire sample application that you could build in a week to impress the management.
JQuery Mobile is very flaky & its event model is overly cumbersome e.g. I spent days figuring out a problem caused by Cordova scripts loading before JQuery or vice-versa.
Furthermore to skin the app to your corporate branding, you will have to fight JQuery Mobile CSS all the way to end. This will result in lot of overrides & messy style sheets.
JQM event model & CSS
We all know “deviceready” doesn’t fire in a browser. So what happens when you have tested your app in browsers & now ready to fire it up in simulators. I experienced lot of frustration to simply get the JQuery mobile event model right.
Every time my Android simulator will start, my app will load all JQuery scripts before “deviceready” getting fired. After some researching, I tried to dynamically load JQuery scripts post “deviceready”, but even that came with lots of issues.
The last straw came when designers provided the final design. When I started to style it, JQuery Mobile CSS was interfering at every step of the way. After lot of overrides & weekend mornings working, I decided to say good bye & I am glad I did. My app is now much more responsible, cleaner & agile than what would have been possible with JQuery Mobile.
JQuery Mobile is still work in progress. Lot of things are being deprecated quite quickly. E.g. if you are stuck & try to Google, the chances are what you find would have been already deprecated.
Single page apps or dynamic page loading
Solution lies in taking full control of your app rather than using a framework like JQuery Mobile & building something of your own to dynamically load pages. You would find this IBM article really helpful in this regard.
Building your own app such way gives you way more confidence & freedom to do things than using JQuery Mobile. Besides it keep things simple & understandable as your code would be lot more cleaner.