Mobile safari - suppress Unsupported Protocol alert

Posted by Juriy on Stack Overflow See other posts from Stack Overflow or by Juriy
Published on 2010-04-29T12:25:01Z Indexed on 2010/04/29 12:27 UTC
Read the original article Hit count: 337

Filed under:
|
|

Hello guys,

I'm creating a website for iPhone and i use the native app (cliqcliq Quickpick) to upload photos. I use the script like the following to check if the application is installed. The basic idea is to send user to a custom url, if application is there it is launched, if it is not there the url should be ignored and user is taken to App Store. Below is the script:

window.launchQuickpic = function() {
    var start = new Date();
 setTimeout(function() {
     if (new Date() - start > 2000) {
     return;
    }
    window.location = 'http://www.cliqcliq.com/quickpic/install/';
}, 1000);

    var getParams = [...];
    window.location = 'vquickpic://?' + getParams.join('&');
};

If the native app is not installed I'm getting the alert box saying that Safari does not recognize the custom url. After user clicks "ok" it works as it is supposed to. But the alert is reeealy annoying.

I've tried to surround the window.location= code with try/catch. Didn't help.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about iphone