How to check if an app is installed from a web-page on an iPhone?

Joakim Engstrom picture Joakim Engstrom · Oct 24, 2012 · Viewed 190.9k times · Source

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.

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?

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.

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

Answer

missemisa picture missemisa · Nov 2, 2012

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.

Hope this helps!

Similar question: