简体   繁体   English

在Iphone,Ipad和使用Safari浏览器 - 提醒“打开myapp”

[英]In Iphone, Ipad and using Safari Browser - An alert “Open with myapp”

In iOS using Safari Browser, an alert "Open with xyz app" is showing before redirect on app if app installed and an alert "Invalid address" then "Open with app store" if app not installed. 在使用Safari浏览器的iOS中,如果安装了应用程序,则在应用程序重定向之前显示“使用xyz应用程序打开”警报,如果未安装应用程序,则会显示“无效地址”警报,然后“使用应用程序商店打开”。

Is there a way to redirect on app if installed otherwise on app store without showing any alert? 有没有办法在app上重定向,如果在app Store上另外安装而没有显示任何警报? Like yelp.com? 喜欢yelp.com?

Currently I am trying it using java script but it is showing an alert. 目前我正在尝试使用java脚本,但它正在显示警报。

document.location.href = "myapp://url?url=" + encodeURIComponent(window.location.href);// "myapp://?url=" + encodeURIComponent(window.location.href);
setTimeout(function () {document.location.href = "appstoreurl";}, 2000);

Can anyone help me to resolve this issue? 任何人都可以帮我解决这个问题吗?

Yes you can. 是的你可以。

For this you need to setup Universal Links . 为此,您需要设置Universal Links You should read the documentation here: 你应该阅读这里的文档:

https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html

The way you are doing it is "deprecated" since iOS 9 从iOS 9开始,你的方式就是“弃用”了

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

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