HTML5 定位 geolocation

HTML5新特性 定位,可以获取当前位置的经纬度:

window.onload = function() {
	window.navigator.geolocation.getCurrentPosition(function(pos) {
		console.log("当前维度" + pos.coords.latitude);
		console.log("当前经度" + pos.coords.longitude);
		console.log("经纬度精度" + pos.coords.accuracy);
	})
}

猜你喜欢

转载自blog.csdn.net/qq_36521848/article/details/106246142