I’m having a problem in PhoneGap 2.3.0 with JQuery Mobile 1.2.0.
Any external link iniOS opens inside the app instead of opening Safari they open inside the app, making it impossible for user to get back to the app without rebooting it.
I have tried both rel=”external” and target=”_blank” to indicate it’s an external link, but none with success.
I have seen that the default way that PhoneGap with JQMobile should act is the way I want. I have found lots of requests for this kind of behaviour, but not the way around.
I added
rel="external"to my anchor links.And then added/overrided the
shouldStartLoadWithRequestmethod in theMainViewControllerclass:That works for me in jQuery Mobile 1.2 and Phonegap 2.2.0. It should work the same in Phonegap 2.3.0 – but I haven’t tested that.
==================================================================================
UPDATE:
There may not be any need to do this in Phonegap 2.7.0 or above. Phonegap can now open links in either of the UIWebView, Safari or the InAppBrowser component. Personally I like the InAppBrowser component, as it seems to be a better user experience for a lot of use cases. If you want to open links in Safari you can now do this now using Javascript:
or this for the InAppBrowser:
Have a look here for more information:
http://wiki.apache.org/cordova/InAppBrowser
http://docs.phonegap.com/en/2.7.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser