且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-06-01 21:53:52

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

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 = "https://itunes.apple.com/appdir"; }, 25);
window.location = "appname://";

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

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

希望这会有所帮助!

类似的问题:

  • 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 *** and Maps?