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
When you get the 'Safari cannot open the page because the address is invalid' error, there might be some minor issue with the page. To refresh the page on the Safari browser, you can drag the page down and release it. Also, you can tap the refresh button to reload the page.
Possible Causes Safari throws this error when it cannot find the protocol for launching an application; this happens when a program (in this case, Zoom or VSee) is not installed. You'll need to install Zoom or VSee.
The first thing that you should do is check your Internet connection as Safari browser shows this error when your iDevice is not connected to either cellular or Wi-Fi network. Check the connection settings and make sure that it is enabled.
Safari might think the address is invalid because the browser is experiencing problems in the background. This happens occasionally with any app. To fix it, quit Safari then open it and try to load the same page again.
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')"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With