<html>
<head>
<title>Geolocation API地理定位</title>
<script type="text/javascript">
navigator.geolocation.getCurrentPostion(function(pos) {
console.log("當(dāng)前地理位置的緯度:" + pos.coords.laitude);
console.log("當(dāng)前地理位置的經(jīng)度:" + pos.coords.longitude);
console.log("當(dāng)前經(jīng)緯度的經(jīng)度:" + pos.coords.accuracy);
});
var watchID = navigator.geolocation.witchPosition(function(pos) {
console.log("當(dāng)前位置變化的緯度:" + pos.coords.laitude);
console.log("當(dāng)前位置變化的經(jīng)度:" + pos.coords.longitude);
console.log("當(dāng)前位置變化的經(jīng)度:" + pos.coords.accuracy);
navigator.geolocation.clearwatch(watchID);
}, function() { });
</script>
</head>
<body>
</body>
</html>