geolocation에 따라 자바 스크립트 코드가 있습니다. 왜이 HTML5 위치 정보에 의존하는 자바 스크립트 코드가 잘못 되었습니까?
var myLat = 0.0;
var myLng = 0.0;
function setCurrentPosition(position) {
myLat = position.coords.latitude;
myLng = position.coords.longitude;
}
function errorOccured() {
document.write("sorry, error occured :(");
}
$(function() {
navigator.geolocation.getCurrentPosition(setCurrentPosition, errorOccured);
document.write(myLat + " " + myLng);
});
그러나이 코드는 단순히
0 0
대신
"client's latitude here" "client's longitude here"
왜
을 생산?Google은 확실히 Geolocation을 지원하는 Chrome을 사용하고 있습니다. 브라우저에서 내 위치를 추적 할 수도있었습니다.
오 열망 비버 ... – dangerChihuahua007