Reputation:
I've got a basic PhoneGap / jQuery-Mobile app on iOS that initially loads up the index.html page that is part of the app. On that page there is a link that points to a page on our mobile site (not deployed as part of the app). This works as I wanted because when I click the link it loads the mobile page in my app (I updated the PhoneGap.plist ExternalHosts so it would load in my app instead of in Safari).
My question is whether from the mobile page displayed in my app, but not part of my app, can I link back to a page that is part of my app? Is this even possible? If not, what are my options for achieving this same behavior?
The basic design that I would like for my app is to have some sort of menu that is always visible with buttons that take you back to the menu of different pages in the app (e.g. Home, Mobile Site, Camera, etc.). Clicking a menu link loads the mobile web page below the nav bar, and this page could be local to the Phonegap app OR a remote page on our server. (optionally, the menu/nav bar could be part of the mobile site -- but this would only work if the Home button on the mobile site page menu would load the app's index.html page).
The plan is to maintain one code base for apps on iOS and Android and still access the phone's capabilities, such as the camera, with PhoneGap. However, rather than having to write .ajax calls for every server side exchange of information (retrieval, db updates, etc.), we could leverage some of our existing server side forms and pages already hosted as .aspx pages by serving them INTO our Phonegap app. Being able to link back and forth between pages in my app and on my mobile site (all using JQuery Mobile) would be ideal if possible. Being able to include phonegap.js on our remote server pages and include javascript API calls to phonegap from inside those pages would be another big bonus if it can be done.
Hopefully this makes sense.
Thanks in advance!
Upvotes: 4
Views: 2264
Reputation:
Yes, we did. We used ChildBrowser as I described below. We had to modify the ChildBrowser user interface on both iOS and Android to hide the address bar and toolbar. It took a little bit of effort to get our mobile site header / menu bar to match our native header bar. The end result is a seamless experience -- you literally can't tell whether you are viewing a native page or a page served up from our mobile site.
Upvotes: 1
Reputation: 1
I would suspect a href could point to the file:///asset/www locally and it should load. If you linked a realitive URL as its switched hosts it will load from the server so the best bet is local paths. You could always runa browser check on your server and output the paths relating to IOS,Android etc.
Have you also checked yet if the app will be approved by apple if its a wrapper loading content from your site?
Upvotes: 0