I have been trying to get inAppBrowser to load my url in an external browser on Android. I have set up inAppBrowser, however using _blank or _system leads to the same outcome. The webpage loads inside the app instead of going out to a browser.
HTML:
<a href="#" rel="external" id="link-forgotPass" >Forgot Password?</a>
JS:
$('#link-forgotPass').bind('click', app.goToForgotPass);
goToForgotPass: function() {
window.open('www.google.com', '_system', 'location=no');
return false;
}
XML:
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.InAppBrowser" />
</feature>
What am I missing? Do I need to bind inAppBrowser some how? Thanks in advance.
What version of Cordova do you have? If it's >= 3.0 you can install the inAppBrowser plugin.
And if its lower, the documentation says that you have to add:
<plugin name="InAppBrowser" value="org.apache.cordova.InAppBrowser" />
in app/res/xml/config.xml
After trying to use InAppBrowser plugin with no avail I found the following snippet. This seems to work in Android for Cordova 3.3. (I chose to bind the <a>
element to a click event in order to execute the javascript code)
Javascript:
$('#link-forgotPass').bind('click', function() { navigator.app.loadUrl('your.url.here', {openExternal:true}); });
HTML:
<a href="#" rel="external" id="link-forgotPass" >Forgot Password?</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.