0

I've searched a lot for this and couldn't find an answer. I need to check, on Mobile Safari, if a certain protocol can be handled (and that way finding out if a certain app is installed on the device).

This CAN be done somehow. If you open mobile twitter (and you have the app installed) it will show a button that takes to the app. Same thing with Instagram: if you open a photo on the browser, and you have the app, it shows a button 'Open in App' , otherwise it shows a link "Download Instagram for Free!" (this is different from Smart Banners).

Does anyone know how this is done?

Thanks.

Jota
  • 149
  • 3
  • 9
  • 1
    It would greatly help when a question is marked as duplicate to link to the alleged original one. Simply closing without any pointer is rather unproductive. – Mitch Match Nov 07 '15 at 08:44

1 Answers1

2

Try something like this:

(function () {
    setTimeout(function () {
        console.log('protocol is not available')
        window.location = 'http://somewhere-else';
    }, 1000);

    window.open('your_protocol://', '_self');
}())

There are also a number of other approaches discussed here: Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

Community
  • 1
  • 1
pdoherty926
  • 9,895
  • 4
  • 37
  • 68
  • On modern iOS, it pops up a dialog box with question, so the timeout should be higher than 1000 in order to give the user time to answer. – Brian Cannard Feb 20 '17 at 22:22