HTML
<a class="intent" href="http://mymobilewebsite" data-scheme="myApp://"></a>
Javascript
(function () {
goToUri($("a.intent").data('scheme'), $("a.intent").attr('href'));
event.preventDefault();
function goToUri(uri, href) {
var start, end, elapsed;
start = new Date().getTime();
document.location = uri;
end = new Date().getTime();
elapsed = (end - start);
if (elapsed < 1) {
document.location = href;
}
}
})();
This code is based on Chase's answer at Here
However the code is sometimes working sometimes not and could not figure out why?