我想使用URL方案打开ios应用程序。我可以使用它打开应用程序。
但是我想如果未安装应用程序,则应打开应用程序商店,以便用户可以下载应用程序。
这可能吗?我怎样才能做到这一点?
编辑
明智地解释问题:
一世。如果在手机中安装了应用程序,则该应用程序将启动。
ii。否则,将打开应用商店以下载应用。
谢
最佳答案
我通过服务器端代码处理了它:
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("com.myapp://");
setTimeout(function() {
if (!document.webkitHidden) {
location.replace("https://itunes.apple.com/app/xxxxxxxx");
}
}, 25);}
else if ((navigator.userAgent.match(/android/i)) || (navigator.userAgent.match(/Android/i))) {
location.replace("https://play.google.com/store/apps/details?id=packagename&hl=en");}
else {
location.replace("http://www.example.com");}
我将其放在我的www.mysite.com/download页面中,并通过广告系列共享此网址。