javascript - Suppress Safari can't open the page because the address is invalid? custom app launch -
i'm launching custom app web browser on iphone.
if app not installed redirecting web page on website.
if installed goes specific page on app
this works expected except 1/2 second safari displays modal window saying following
cannot open page safari cannot open page because address invalid.
i know address invalid , know if possible suppress error message in safari.
thanks
i did find solution worked this. had working settimeout of 25ms. reason on nexus 5 needed drop down 5ms.
i ended using following:
function gotoapp(applocation, fallbacklocation) { settimeout(function() { window.location = fallbacklocation; }, 5); window.location = "nativeappurl://" + applocation; } function gotoweb(baseurl, weblocation) { window.location =baseurl + "/"+ weblocation; } </script>
then have 2 buttons have
onclick="gotoapp('appdestination', 'location')"
and
onclick="gotoweb('webdestination', 'location')"
Comments
Post a Comment