Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 views
in Technique[技术] by (71.8m points)

android - What is the intent to launch any website link in Google Chrome

Hi I want to open the website in chrome app from my app webview when user click on particular link. I see this is possible https://developer.chrome.com/multidevice/android/intents, here on this it's for the zxing app, not for google chrome.

<a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a>

I want same syntax for Google Chrome. Currently I am opening link in the webview, on click on link I want to specify a intent of chrome there like zxing.

In other words, I have a webview in which I opened a particular URL then after if user click on "XYZ" or something in the webview there then it should open google chrome. So for this i will add some chrome intent tag in the html that's syntax I am looking –

Please share if you know syntax for opening Google Chrome any hyperlink.

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It seems you're looking for the new Android Intents link that will create and explicit intent for the device for a link.

<a href="intent://<URL>#Intent;scheme=http;package=com.android.chrome;end">

works for me. so

<a href="intent://stackoverflow.com/questions/29250152/what-is-the-intent-to-launch-any-website-link-in-google-chrome#Intent;scheme=http;package=com.android.chrome;end"> 

will take you to this question in Chrome. Note that the scheme is specified separately so if you want to launch https links, you'd have to change scheme to scheme=https

But as everyone is saying, an explicit Chrome intent is a very non-Android thing to do. A better way would be to specify the ACTION_VIEW action like so:

<a href="intent://stackoverflow.com/questions/29250152/what-is-the-intent-to-launch-any-website-link-in-google-chrome#Intent;scheme=http;action=android.intent.action.VIEW;end;">

Source: The same page you linked

Thanks, I learned something today!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...