3

Reference: How do I open any app from my web browser (Chrome) in Android? What do I have to do with the A Href link?

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

If a user clicks on the link using Android Chrome, then it opens the barcode scanner app. But if I set window.location = "intent url" it doesn't open the barcode scanner app.

intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end

Does Chrome not allow this? Is there any way to fix this issue?

Community
  • 1
  • 1
kk-dev11
  • 2,654
  • 5
  • 37
  • 48

1 Answers1

2

You can use implicit intent.

A good tutorial can be found here. You can open any custom protocol urls like below, it may be not only chrome, but any mobile browsers.

example://SomeHostPrefix/?UserName=abcdef&SessionId=12345

enter image description here

However, you cannot open arbitrary Apps, the app must have declared something in its manifest file:

enter image description here

David
  • 15,894
  • 22
  • 55
  • 66
  • 1
    for example the implicit intent, fb://profile, doesn't work with window.location. – kk-dev11 Jul 26 '16 at 15:42
  • 2
    Well, I have mentioned that if a user clicks on the link (anchor tag) using Android Chrome, then it opens the barcode scanner app. But it doesn't work, if I set window.location = "intent url", when the page loads. – kk-dev11 Jul 26 '16 at 20:45