13

I'm launching a custom app from a web browser on the iphone.

If the app is not installed I am redirecting to a web page on the website.

If it is installed it goes to a specific page on the app

This all works as expected except for about 1/2 a second safari displays a modal window saying the following

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

I know the address is invalid and I would like to know if its possible to suppress the error message in safari.

Thanks

1
  • 5
    Did you find a solution Nate? Commented Jan 10, 2014 at 16:29

1 Answer 1

1

I did find a solution that worked for this. I had it working with a setTimeout of 25ms. But for some reason on a nexus 5 I needed to drop it down to 5ms.

i ended up using the 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 I just have two buttons that have an

 onclick="goToApp('appDestination', 'location')"

and

 onclick="goToWeb('webDestination', 'location')"
1
  • 1
    Have you just reduced the timeout and the "Cannot Open Page" message disappeared? Commented Feb 18, 2014 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.