Skip to content

Instantly share code, notes, and snippets.

@hkongm
Created August 29, 2013 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkongm/6375666 to your computer and use it in GitHub Desktop.
Save hkongm/6375666 to your computer and use it in GitHub Desktop.
HTML5 API
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
var jingdu = position.coords.longitude, // 经度
weidu = position.coords.latitude; // 纬度
});
} else {
alert('您的浏览器不支持地理位置查询!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment