如何检查iPhone上的网页是否安装了应用程序?

编程入门 行业动态 更新时间:2024-10-26 16:35:19
本文介绍了如何检查iPhone上的网页是否安装了应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想创建一个网页,如果iPhone没有安装应用程序,该网页会将iPhone重定向到应用程序商店,但如果iPhone安装了应用程序,我希望它打开应用程序。

I want to create a web-page, a page that will redirect an iPhone to the app-store if the iPhone does not have the application installed, but if the iPhone has the app installed I want it to open the application.

我已经在iPhone应用程序中实现了一个自定义URL,所以我有一个应用程序的URL,如下所示:

I have already implemented a custom url in the iPhone application so I have an url for the application that is something like:

myapp://

如果这个网址无效,我希望页面重定向到应用商店。 这可能吗?

And if this url is invalid, I want the page to redirect to the app store. Is this possible at all?

如果我没有在手机上安装应用程序并在safari中写下myapp:// url,那么我get是一条错误消息。

If I don't have the application installed on the phone and write the myapp:// url in safari, all I get is an error message.

即使存在javascript的丑陋黑客,我真的很想知道吗?

Even if there exists an ugly hack with javascript I would really like to know?

推荐答案

据我所知,您无法通过浏览器检查是否安装了应用程序。

As far as I know you can not, from a browser, check if an app is installed or not.

但是您可以尝试将手机重定向到应用程序,如果没有任何反应,请将手机重定向到指定页面,如下所示:

But you can try redirecting the phone to the app, and if nothing happens redirect the phone to a specified page, like this:

setTimeout(function () { window.location = "itunes.apple/appdir"; }, 25); window.location = "appname://";

如果第二行代码给出了结果,那么第一行永远不会被执行。

If the second line of code gives a result then the first row is never executed.

希望这会有所帮助!

类似的问题:

  • iPhone浏览器:检查是否有iPhone应用已从浏览器安装
  • 是否可以为YouTube应用程序注册基于http +域的URL方案,如YouTube和地图?
  • iPhone browser: Checking if iPhone app is installed from browser
  • Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

更多推荐

如何检查iPhone上的网页是否安装了应用程序?

本文发布于:2023-10-28 08:44:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536133.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   网页   安装了   iPhone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!