user2330237
user2330237

Reputation: 1703

Meteor app open URL in chrome browser on Android

For a Meteor app, on Android/Cordova we need to create a url link button for the user that, when clicked, will open up a URL in a chrome browser (as opposed to opening it within the app itself) and pass a parameter to it (the user ID). Is there a Meteor package to do this (couldn't find one)? Is there simple js to do this (couldn't get js from other similar SO questions to work in this context)?

Thanks

Upvotes: 1

Views: 1171

Answers (2)

Kinlan
Kinlan

Reputation: 16607

If know you are on android, use the Intent syntax URL

intent:host/a/path/#Intent;scheme=http;package=com.android.chrome;end

Try on the demo page:

<h2>Launch in Chrome Stable</h2>
<a href="intent:www.xhaus.com/headers#Intent;scheme=http;package=com.android.chrome;end">Open</a>

<h2>Launch in Chrome Beta</h2>
<a href="intent:www.xhaus.com/headers#Intent;scheme=http;package=com.chrome.beta;end">Open</a>

Upvotes: 1

Christian Fritz
Christian Fritz

Reputation: 21374

You might be looking for this package: https://github.com/apache/cordova-plugin-inappbrowser. Once installed, you can open a link in the system browser (chrome), by using _system as the target:

var ref = cordova.InAppBrowser.open(url, "_system", options);

However, even without this package you should be able to do what you want like this:

window.open(url, '_system');

Upvotes: 1

Related Questions