이
Google Maps Geolocation - Google Developers
HTML5 위치 정보이다 그러나 여기 JSFiddle
은 기본적으로 당신의 GPS를 사용하려면 사용자의 액세스를 요청해야합니다 후 당신이있어 무엇을 같은 소리들이 장치.
그 다음부터는 HTML5 Geolocation Navigator를 사용하여 기기를 통해 사용자의 위치를 가져옵니다.
// Try HTML5 geolocation.
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
infoWindow.setPosition(pos);
infoWindow.setContent('Location found.');
map.setCenter(pos);
}, function() {
handleLocationError(true, infoWindow, map.getCenter());
});
} else {
// Browser doesn't support Geolocation
handleLocationError(false, infoWindow, map.getCenter());
}