PDA

View Full Version : App for both mobile and desktop browsers



marcuswu
30 Sep 2011, 7:53 AM
I desire to create an app for mobile browsers, but also for desktop browsers. I desire to use ext js for the desktop browsers and sencha touch for the mobile devices. My question is whether these two can co-exist, and if so, how would I go about building one app for both (ideally using the same codebase)?

Thanks,
Marcus

wilzdezign
30 Sep 2011, 9:20 AM
Could you just use some server side code or sniffer to check what type of browser/OS, then either include / redirect to the EXT or Touch version?

marcuswu
30 Sep 2011, 11:09 AM
Yes, I could -- that is a solution, but I would prefer not to complicate the codebase by mixing in server side scripting (I will rely on some web services, but that is not the same as relying on server side logic in the app).

A bit of extra info I didn't include earlier: the application is coming from an iPad app and is intended to function on tablet or desktop. It is not targeted toward phones. That allows the UI fewer differences visually and functionality-wise between the two versions (UI code may and probably will be different).

The Ext.isDesktop value should help, but a solution utilizing it would rely on either both Ext JS and Sencha Touch being loaded at the same time which I'm not sure would co-exist nicely or part of one or the other being loaded, then making a decision about which to complete loading.

If it can't be done, obviously I'll need to find a different way, but I wanted to see if anyone knew if this is doable.

wilzdezign
30 Sep 2011, 2:57 PM
Yes, that would be a nice mashup, if Ext could be the base (and namespace) and extend Touch, so within the framework you could just set the conditional isPhone or isDesktop to create the init() for it to start.

Right now, I can only see the server-side setting the initial namespace and either include the ext.js or the touch.js and its own init(). I am not sure how well cross framework the Panel and attributes work between Ext <> Touch, though they are similar. I think you could do it ONLY with a lot of conditional statements for each framework in one JS script. I bet Sencha has thought about that. I am sure they found that by needing Touch to have a smaller file size/base to gear towards mobile, it could not include all the Ext framework too. Using Ext and extending with Touch would make the base size too large. So they split them to make Touch slimmed down and added the touch and orientation functionality