At https://gist.github.com/rajeshsegu/3716941 you can find the gist for browser detection. Despite it does not contains the Safari block, you can simply duplicate the Chrome ones, it works like a charm.
For the lazy ones, here the function:
function launchSafari(){
var url = getUrl(),
protcolEl = $('#protocol')[0];
isSupported = false;
protcolEl.focus();
protcolEl.onblur = function(){
isSupported = true;
console.log("Text Field onblur called");
};
//will trigger onblur
location.href = url;
//Note: timeout could vary as per the browser version, have a higher value
setTimeout(function(){
protcolEl.onblur = null;
result()
}, 500);
}
This is where it is called:
//Handle Click on Launch button
$('#launch').click(function(){
if($.browser.mozilla){
launchMozilla();
}else if($.browser.chrome){
launchChrome();
}else if($.browser.msie){
launchIE();
}else if($.browser.safari){
launchSafari();
}
});
PS: I'm not a JS expert. Maybe someone could improve the JS code