Avoid the error when trying to redirect the user protocol scheme (appname: // location) if it is not registered

I use the "Bounce" web page, which is associated with a text message, to open my application. The Bounce web page does this:

<script type="text/javascript">
   window.location.href = "appname://location";
</script>

and it works fine if the protocol scheme appname: // is registered. But if it is not, an error message is displayed to the user:

Cannot open the page.
Safari cannot open the page because the address is invalid.

Any ideas on how to try to do this redirection but not show an error if it doesn't work?

+4
source share
2 answers

javascript, "", , , ​​ URL

document.location = "appname://location";
setTimeout(function(){
    document.location = "http://google.com";
}, 50);
+4

All Articles