Maps URLs on mobile Safari

I’ve been experimenting a little bit with maps urls on the iphone. If you’ve read Apple’s web developer guidelines, you’ll know that URLs of this form will automatically redirect to the maps application:

Halifax, Nova Scotia
<a href=”,Nova Scotia”>Halifax, Nova Scotia</a>

This is fine if you just want to highlight one particular location (with no custom metadata), but what if you want to do something more interesting, like display a KML file? You can load these easily from the maps application, so why can’t you link to them from a web browser? The URL guidelines explicitly say that the KML part of a query string will be discarded, and indeed it is. What is a web developer to do? Resort to undocumented behaviour, of course! At least in version 2.2 of the iphone software, URLs which request a “maps” resource with the appropriate parameters will automatically load the appropriate KML file in the maps application:

Map link
<a href=”maps://?geocode=&q=”>Map link</a>

One thought on “Maps URLs on mobile Safari”

  1. Well done for putting the power back in the hands of the people. This makes routing efficient. It would be good if it could use Nav sat positioning to show where the buses were on the route. That would beat calling the bus line from my cell phone. Just like the back of the New York cabs you can see yourself traveling through the streets. Bit of a gimmick but it would be great if you could see how far away the next bus was. Nice One

Comments are closed.