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

iosiphonemobile-safariweb-applications

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 a 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.

Best Solution

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.

Similar questions: