Cordova : Open A Link Using Google Chrome
I would like to open a link using Google Chrome (not another browser) from my Cordova application. I tried several solutions but nothing works. First, I tried to create a link to g
Solution 1:
You can use cordova-plugin-inappbrowser with _system
as target:
cordova.InAppBrowser.open('http://stackoverflow.com', '_system', 'location=yes');
Or you can use cordova-plugin-webintent2 (don't know if this is the same you are using), like this:
window.plugins.webintent.startActivity({
action: window.plugins.webintent.ACTION_VIEW,
url: "googlechrome://navigate?url=http://www.stackoverflow.com"
},
function() {},
function() {
alert('Failed to open URL via Android Intent.');
console.log("Failed to open URL via Android Intent.")
});
The url must start with http or https, it does not allow relative urls.
Solution 2:
I finally found the solution. I just had to create a link like this one :
<ahref="googlechrome://navigate?url=https://my.url.com/"></a>
Post a Comment for "Cordova : Open A Link Using Google Chrome"