I have a mobile app made with Phonegap which displays news articles which may contain links. I want those links to open in a proper browser, seperate from the app. I cannot find a single way to do this which gives the same results in Android and iOS after I upgraded from Phonegap version to 2.0.0 to 2.1.0 (since you cannot rotate the screen in iOS prior to 2.1).
<a href="http://blah">
Always opens within the app, no browser toolbars, and no way to get back to the app without terminating it. iOS obeys <access origin="http://blah" />
in config.xml but Android doesn't. Neither seem to care about the browserOnly="true"
attribute.
<a href="http://blah" target="_blank">
iPhone opens this within Safari browser if <access>
allows it (or is omitted entirely), but Android opens it within the app .
<preference name="stay-in-webview" value="false" />
Adding this to config.xml makes no difference at all.
<a href="#" onClick="navigator.app.loadUrl('http://blah',{openExternal:true});return false;">
Only supported in Android, where it opens the link in Chrome browser. Errors in iOS.
<a href="#" onClick="window.open('http://blah','_blank','location=yes');return false;">
In Phonegap version 2.3.0 this will stay within the app but shows a cheap-looking browser toolbar at top/bottom with a button that allows you to return to the app. This is consistent...but not what I want. (In version 2.1.0 this causes Android to open within the app and iOS to open in proper browser.)
I am using Phonegap Build so this solution will not work.
The official documentation refers to this blog post which was written with reference to version 1.5.0 and my 2.1.0 to 2.3.0 findings do not match with their table.
I don't really want to add a plugin for something this simple.
Is there a single piece of code which will cause a link to open in the device's own browser, outside of the app's webview, regardless of OS?