深层链接不适用于Chrome [英] Deep linking not working in chrome

查看:175
本文介绍了深层链接不适用于Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图进行深层链接,这样当有人从手机浏览器打开链接时,它会打开该应用程序(如果已安装)或打开Play商店链接以下载该应用程序。



这是我的URI:

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

当我在Mozilla Firefox应用程序中输入Android,它会打开我的应用程序,如果它安装或打开播放存储链接,如果它没有安装。但是,当我在Chrome中输入相同的内容时,而不是打开应用或Play商店,它只是进行谷歌搜索。这是一个已知的 wontfix Chrome 40+中的错误(请参阅Chromium项目标签)。



本质上,Chrome团队认为,如果用户在地址中实际输入 酒吧,不应该发生重定向。正如您发现的,这与所有其他浏览器的行为相反。



幸运的是用户实际上不会输入 intent://手动 URI。如果您将URL包装在网页的链接中,或者提供指向其他页面的链接,然后发布某种类型的重定向(以便您可以检测到用户代理并且不会显示已损坏 intent :// 链接到其他浏览器上的用户),它应该能够正常工作。



如果你不想处理所有这些边缘情况,你也可以尝试免费的服务,如 Branch.io (全面披露:我在球队中)。


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?

解决方案

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).

这篇关于深层链接不适用于Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆