简体   繁体   English

我怎么知道Safari是否已经在iPhone上安装了应用程序

[英]How do I know if an app is already installed on iPhone from Safari

I'd like to know if is it possible to check from Safari via Javascript if there is a specific app already installed . 我想知道是否可以通过Javascript从Safari检查是否已经安装了特定的应用程序 I'm doing a login form for an application from the web that goes into the app and I'd like to call that application. 我正在为进入应用程序的网络上的应用程序填写登录表单,我想调用该应用程序。 I'm using that code right now: 我现在正在使用该代码:

{% if request.ios %}
            var backup_url = window.location + "&no_app=True";
              setTimeout( function()
              {
                  document.location = backup_url;
              }, 200);
            window.location = "{{ apple_url }}";
{% endif %}
});

There is a check to know if the device is an iOS device. 会检查该设备是否为iOS设备。 After that I check if the '&no_app=True' is appended on the url. 之后,我检查网址上是否附加了“&no_app = True”。 If it is appended I don't need to check it. 如果已附加,则无需检查。 Otherwise I have a 200ms where I wait to append it and I try to open the app with: 'window.location = "{{ apple_url }}";' 否则,我有200毫秒等待添加的位置,然后尝试使用以下代码打开应用程序:'window.location =“ {{apple_url}}”;'

I'd like to track people with Google Analytics so I need to know if the app is installed, in this way I'm just hoping that it is. 我想使用Google Analytics(分析)跟踪用户,因此我需要知道该应用程序是否已安装,以这种方式我只是希望如此。 Do anyone know how to do it? 有人知道怎么做吗?

您想看看Smart App Banners

The only way I know of to do this is to have the other app support a unique custom URL scheme. 我唯一知道的方法是让其他应用程序支持唯一的自定义URL方案。 You can then ask the system if there are any apps installed that will respond to your custom scheme. 然后,您可以询问系统是否安装了可以响应您的自定义方案的应用程序。 If the answer is yes, you can be sure the other app is installed and ready to run. 如果答案是肯定的,则可以确定另一个应用程序已安装并可以运行。

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

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