Firefox浏览器Android不启动应用程序时,链接被点击 [英] Firefox for Android does not launch app when link is clicked

查看:209
本文介绍了Firefox浏览器Android不启动应用程序时,链接被点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firefox不火的意图点击链接的方式,它应该。因此,人们无法通过单击在Firefox(这是可能的Chrome和其他浏览器)的链接推出自己的应用程序。

Firefox does not fire intents for clicked links the way it should. Therefore one cannot launch their app by clicking a link in Firefox (which is possible in Chrome and other browsers).

的期望的行为如下: 在我的网站,我有一个链接,当点击应该推出我的Andr​​oid应用程序。如果未安装该应用程序,preferably它在谷歌播放页面应开放下载。

The desired behavior is the following: On my website I have a link, that when clicked should launch my Android app. If the app is not installed, preferably its page in Google Play should be opened to download it.

我实现它的方式与形式的意图URI: 意图://myhost.com/#Intent;计划= myscheme;包= com.myapp;结束

The way I implement it is with an "intent URI" of the form: intent://myhost.com/#Intent;scheme=myscheme;package=com.myapp;end

在应用程序,我注册一个意图过滤器在我的清单,并听取了一个匹配的意图。但是,它是由浏览器来触发这种意图的链接被点击的时候,让我的应用程序可以启动。

In the app I register an intent filter in my manifest and listen for an intent that matches. However, it is up to the browser to fire such an intent when the link is clicked, so that my app can start.

我已经测试了这种方法,不同的浏览器,它工作在其中的大多数。 与Firefox的除外。使用其他浏览器或者我的应用程序启动,或它在谷歌播放加载页面(如果它不是在设备上安装)。

I have tested this method with various browsers, and it works on most of them. With the notable exception of Firefox. With other browsers either my app launches, or its page in Google Play loads (in case it's not installed on the device).

与意图URI的方法是推荐一个接谷歌。它的工作原理完全可以在Chrome浏览器和其他一些浏览器。 也有其他的方法。我看了很多线程和文章的可能性。其主要替代品是:

The method with the "intent URI" is the recommended one by Google. It works perfectly on Chrome and on some other browsers. There are also other methods. I have read many threads and articles about the possibilities. The main alternatives are:

  1. 使用自定义配置,如 myscheme://mywebsite.com
  2. 在使用常规的HTTP链接,如 http://mywebsite.com
  1. using a custom scheme, like myscheme://mywebsite.com
  2. using a regular http link, like http://mywebsite.com

方案1,不推荐,原因有二: - 我没有这样的计划,不存在全局,这是错误的。谷歌还使用市场:// ... 启动谷歌Play应用,但他们都承认,这是错误的,应该改变。 - 如果当前未安装我的应用程序,它不会被启动,并且大多数浏览器显示错误页面,这显然是不可取的。

Alternative 1 is not recommended for two reasons: - I do not own such a scheme, it does not exist globally, it's wrong. Google was also using market://... to start the Google Play app, but they have admitted that this is wrong and should change. - If my app is not currently installed, it will not be started and most browsers display an error page, which is obviously undesirable.

方案2不能在大多数浏览器工作,似乎是pcated赞成意图URI法德$ P $。

Alternative 2 does not work on most browsers and seems to be deprecated in favor of the "intent URI" method.

仅适用于自定义方案(可选择1)。在常规http链接(备选2)的情况下,它只是加载链接,并显示该网站。在推荐意图URI法的情况下,它不执行任何操作。实际上,它显示一个对话框,询问你是否要启动的应用程序,但是当您单击是,​​没有任何反应。如此看来火狐承认喜欢的链接。意图:// ... ,但不处理他们正确

only works with the custom scheme (alternative 1). In the case of a regular http link (alternative 2) it just loads the link and shows the website. In the case of the recommended "intent URI" method, it does nothing. Actually, it shows a dialog asking whether you want to launch the app, but when you click Yes, nothing happens. So it seems Firefox recognizes links like "intent://..." but doesn't handle them properly.

问:什么是启动在Firefox的链接的应用程序推荐的方法是什么?为什么不是故意URI方法Firefox支持?

Q: What is the recommended method for launching an app from a link in Firefox? Why isn't the "intent URI" method supported by Firefox?

相关链接: <一href="https://developers.google.com/chrome/mobile/docs/intents">https://developers.google.com/chrome/mobile/docs/intents http://stackoverflow.com/a/3472228/1045941 (记住,线程是很旧)

Related links: https://developers.google.com/chrome/mobile/docs/intents http://stackoverflow.com/a/3472228/1045941 (keep in mind that the thread is quite old)

推荐答案

一个办法是增加一个隐藏的iframe,是这样的:

One option would be to add a hidden iframe, something like:

<iframe src="myscheme://..." style="visibility: hidden"></iframe>

据测试,在Firefox,但它不会在Chrome工作。你可能想使用一些用户代理检测,这里有一个例子:的http://www.mazdigital.com/blog/post/2014/deep-links-on-mobile-browsers-demystified/

这篇关于Firefox浏览器Android不启动应用程序时,链接被点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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