Check if any application can handle URL scheme in iOS mobile safari

Is there a way to check if iOS can handle a custom URL scheme? I have an application that has registered a custom URL scheme in order to be able to open the application from a hyperlink in a mobile safari. Be that as it may, I would like to inform the user that they need to go to the Appstore in order to download the application if it is not installed.

Is there any reasonable way to check the url and catch when it is not working, and the reason for its failure?

+3
source share
1 answer

This is the best I can think of, but it was tested only in iOS 5:

<a href="myapp://path">link text</a>, : <a href="http://mydomain.com/launchapp?location=path">link text</a>, /launchapp iframe URL-: <iframe src="myapp://path" style="display:none"></iframe>. Appstore, .

: launchapp, URL . : , "URL ", "", " ".

- 2013

SO. -, , App Store ( ):

// setup fallback (redirect to App Store)
var start = (new Date()).valueOf();
setTimeout(function() {
    var end = (new Date()).valueOf();

    // prevent App Store redirect upon returning to safari from myapp
    if (end - start > 1000) return;

    // get a seamless redirect if you use itms://... instead of http://itunes.com/...
    window.location = 'itms://my/app/URI';
}, 25);

// Attempt to load my custom url scheme
window.location = 'myapp://my/path'
+6

All Articles