There is this old tricks that it always never fails me.
The core functionality that you need is setTimeout
. I will tell you in detail:
setTimeout(function() {
window.location = "http://itunes.com/app/yourapplocation";
}, 200);
// once you do the custom-uri, it should properly execute the handler, otherwise, the settimeout that you set before will kick in
window.location = "https://stackoverflow.com/questions/24779312/myapp://superlink";
Now you mentioned that it maybe a link or links so I made this nice function just for your convenience:
HTML code
<a href="https://stackoverflow.com/questions/24779312/myapp://superlink" data-href-alt="http://itunes.com/app/yourapplocation">Click here</a>
JS code
$("a[href*='myapp://']").click(function(e)
{
var el = $(this);
setTimeout(function() {
window.location = el.data("data-href-alt");
}, 200);
// once you do the custom-uri, it should properly execute the handler, otherwise, the settimeout that you set before will kick in
window.location = el.data("href");
e.preventDefault();
});
Hope this will help you
🙂