My web page detects the OS and browser, and in the case of iOS Safari will launch my app using a custom URL scheme.
It works fine on my test devices, but I'm seeing an issue with a user using Safari/9.0 on iOS/9.3.2 - the link simply does nothing!
Are custom URL schemes no longer supported? Do I need to start using universal links instead?
For those interested, here is the Javascript code I use in iOS browsers (which is working 99% of the time):
var timer;
var heartbeat;
var lastInterval;
window.addEventListener("pageshow", function(evt){
clearTimers();
}, false);
window.addEventListener("pagehide", function(evt){
clearTimers();
}, false);
function getTime() {
return (new Date()).getTime();
}
// For all other browsers except Safari (which do not support pageshow and pagehide properly)
function intervalHeartbeat()
{
var now = getTime();
var diff = now - lastInterval - 200;
lastInterval = now;
if(diff > 1000)
{ // don't trigger on small stutters less than 1000ms
clearTimers();
}
}
function clearTimers()
{
clearTimeout(timer);
clearTimeout(heartbeat);
}
function intervalHeartbeat()
{
if (document.webkitHidden || document.hidden)
{
clearTimers();
}
}
function launch()
{
lastInterval = getTime();
heartbeat = setInterval(intervalHeartbeat, 200);
timer = setTimeout(function ()
{
logErrorToMyServer();
}, 2000);
//Launch app via custom URL scheme
window.location = "myapp://";
}