Detecting installed apps on iPhone with javascript

2019-06-25 12:53发布

问题:

I am building a HTML5 based mobile web app for iPhone. I need to check whether user has specific application that I suggest. I heard that each iPhone application has unique URL scheme to detect their app indentity.

Therefore, I've read this article to get an idea.

Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

However, this is not perfect answer to make what I am trying to make.

here is what might happen

  1. User clicks a recommendation app on mobile web browser.
  2. Check with application iTunes URL and URL scheme.
  3. If the user has the installed application, it returns 'installed' ==> In this case, the screen returns back to mobile browser.

  4. If the user does not have the installed application, it returns 'uninstalled' ==> In this case, the screen moves to App Store.

I am running mobile web app with PHP language.

Thank you.

回答1:

this is not possible I'm afraid. To be honest I'm glad, as there are real privacy concerns if any old web page can detect which apps I have installed.

That's definitely not a good thing!

UPDATE: If you're happy to go native, this library will do what you want.. http://www.cocoacontrols.com/platforms/ios/controls/ihasapp



回答2:

If you know that a url scheme for the app exists then you can open it via a web link like this, "myapp://". With this there are some round about ways you can effectively check if a certain app exists.

See this related stackoverflow post