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
348 views
in Technique[技术] by (71.8m points)

android - Deep linking not working in chrome

I am trying to do deep linking such that when someone opens a link from mobile browser, it either opens the app, if it is installed or opens the play store link to download the app.

Here is my URI :

intent://scan/#Intent;scheme=com.example.android;package=com.example.android;end

When I type this in Mozilla Firefox app on Android, it opens my app if it is installed or opens the play store link if it not installed. But, when I type the same thing in Chrome, instead of opening app or play store, it just does a google search. What is wrong with my solution and how do I make it work?

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

This is a known wontfix bug in Chrome 40+ (see the Chromium project ticket here for the full story).

Essentially, the Chrome team feels that if a user actually types something into the address bar, no redirect should ever happen. As you've discovered, this is counter to behavior in all other browsers.

Fortunately it's unlikely a user would actually type an intent:// URI by hand. If you wrap the URL inside a link on a webpage, or offer a link to another page and then issue a redirect of some kind (so that you can detect the user agent and not show a 'broken' intent:// link to users on other browsers), it should work correctly.

If you don't want to handle all these edge cases, you could also try a free service like Branch.io (full disclosure: I'm on the team).


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

...