简体   繁体   English

如何在Android上通过网络打开应用

[英]How to open an app from web on Android

I create 'iframe' element, use the http scheme to open an app on Android Device, it works fine if the app is installed. 我创建了'iframe'元素,使用http方案在Android设备上打开了一个应用程序,如果已安装该应用程序,则可以正常运行。

When the app is not installed, I use setTimeout function setting window.location = marketurl , it will open market, and it works fine on Android Browser , but it doesn't work on chrome 25+ . 当未安装该应用程序时,我使用setTimeout函数设置window.location = marketurl ,它将打开市场,并且在Android浏览器上可以正常工作,但在chrome 25+上不起作用。

I only see an error message in my browser. 我在浏览器中只看到一条错误消息。 What should I do? 我该怎么办?

I believe there are some new changes to the functionality in Chrome for Android v. 25 and later. 我认为Chrome for Android v。25及更高版本中的功能有一些新变化。 You may need to implement Intent. 您可能需要实现Intent。 This is created to prevent unsafe app open from the browser. 这样做是为了防止从浏览器打开不安全的应用程序。

Here is one example from Google Chrome for developers that will open the Zxing barcode scanner app. 这是Google Chrome开发人员的一个示例,该示例将打开Zxing条码扫描器应用程序。

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

Reference: https://developer.chrome.com/multidevice/android/intents 参考: https : //developer.chrome.com/multidevice/android/intents

It is no longer possible to launch an Android app by setting an iframe's src attribute. 不能通过设置iframe的src属性来启动Android应用。 For example, navigating an iframe to a URI with a custom scheme such as paulsawesomeapp:// will not work even if the user has the appropriate app installed. 例如,即使用户安装了适当的应用程序,使用自定义方案(例如paulsawesomeapp://)将iframe导航到URI也不起作用。 Instead, you should implement a user gesture to launch the app via a custom scheme, or use the “intent:” syntax described in this article. 相反,您应该实现用户手势以通过自定义方案启动应用程序,或使用本文中介绍的“ intent:”语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM