Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link to iPhone map App from HTML page

Is there a way to link to directions in the iPhone map app from a html page?

We're placing an add in an iPhone app which will link to a mobile page on our website - we'd like to add a directions link, thus far google searches have been unrevealing.

like image 550
toomanyairmiles Avatar asked Jul 27 '11 07:07

toomanyairmiles


3 Answers

A link to http://maps.google.com/maps will automatically open in the map application

You can set a destination address (daddr) and start address (saddr) in the link:

http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino

You can see some more options at:

https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

like image 184
fchasen Avatar answered Nov 12 '22 23:11

fchasen


Here is a javascript function that creates the link:

function mapLink(myAddress) {
    return 'http://maps.google.com/maps?q='+escape(myAddress);
}

This works great on the iPhone.

like image 30
goferteeth Avatar answered Nov 13 '22 00:11

goferteeth


If you use the standard link that would display a map in the browser, it will automatically open in Google Maps on the device. That includes links that show directions.

like image 35
Kendall Helmstetter Gelner Avatar answered Nov 12 '22 22:11

Kendall Helmstetter Gelner