1

Need to open native maps app on iPhone and/or android phones out of a mobile website. Currently I did this by simply open a maps.google.com link.

Since iOS6 is released this seems not working any more. Are there any standardized or at least well known methods to accomplish opening native maps on most platforms?

If not, can I check the mobile OS to do some special things on every mobile phone?

SpaceBeers
  • 13,617
  • 6
  • 47
  • 61
dasheddot
  • 2,936
  • 4
  • 26
  • 33
  • I believe on iOS it has changed to maps.apple.com? But I'm not aware of any cross-platform URL that will work on both iOS and Android. – Robotic Cat Sep 20 '12 at 17:51

1 Answers1

3

In order to support opening the native maps app across the most recent iOS versions you're going to have to check the type of device, as iOS 6 devices will direct users to the google maps website, rather than their native app.

The best way to detect devices is via the User-Agent HTTP header. This is documented all over the net with front end javascript device detection, or back end device detection. How you approach the detection is up to your own implementation.

You can continue to use maps.google.com for everything other than iOS 6 I believe and Apple have documented their iOS6 Maps URL scheme in their Map Links documentation.

An example of an Apple Maps link would be

<a href="http://maps.apple.com/maps?daddr=San+Francisco,+CA&saddr=cupertino">Directions</a>
Jessedc
  • 12,320
  • 3
  • 50
  • 63
  • I tried a fiddle with the link. Works in Chrome and opens in Google map. However Safari doesn't work? Seems weird since the link and safari are from apple. – resting Feb 10 '14 at 17:05