Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Created November 27, 2012 01:28
Show Gist options
  • Save max-mapper/4151806 to your computer and use it in GitHub Desktop.
Save max-mapper/4151806 to your computer and use it in GitHub Desktop.
link to lat/lon in native maps app on ios and android from webview (phonegap)
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon
// assumes you have zepto and zepto.detect loaded
// also you should use target=_blank on your <a> tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment