ocon - 7:34 am on Sep 1, 2013 (gmt 0)
I created a link that opens in the Google Maps website on desktop computers and in the Google Maps app on iOS devices.
<a href="http://maps.google.com/maps?q=X" id="link">Link</a>
if(navigator.userAgent.match(/iPhone|iPod/i)) document.getElementById("link").href = "comgooglemaps://?q=X";
The link, obviously, fails on iOS devices that do not have the Google Maps app by giving this alert: "Cannot Open Page: Safari cannot open the page because the address is invalid."
What I would like to do is silently "catch" url errors and redirect using an Apple Maps link.