I'm using Phonegap Build to deploy mi Apps, I'm using the Cordova 3.3.0 version.
I want open external links in the native browser (Android/iOS). I'm trying to use the InAppBrowser plugin of Cordova, but it doesn't work for me. Open the links but inside the App without back button... :/
I've seen answers like Include phonegap.js file (but when deploys with Phonegap Build you don't have to include it, PGB do it for you), or using or using a function to open links + InAppBrowser Plugin, or even who say that this is fixed deploying locally, but I can't deploy locally because my Mac doesn't support the new versions of XCode and iOS SDK's.
This is the relevant code of my config.xml:
<preference name="phonegap-version" value="3.3.0" />
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.3.3" />
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
<access origin="*" />
This is the JS function I've been trying:
function abrirURL(url){
if(device.platform === 'Android') {
navigator.app.loadUrl(url, {openExternal:true});
} else {
window.open(url, '_system');
}
}
And the links I tried, from the most basic to the use of functions:
<a href="http://www.example.com" target="_blank">Link</a>
<a href="#" onClick="abrirURL('http://www.example.com');">Link</a>
<a href="#" onClick="window.open('http://www.example.com', '_blank');">
<a href="#" onClick="window.open('http://www.example.com', '_system');">
Nothing of this works for me, somebody help me please. Thanks!