Created
January 7, 2020 02:38
-
-
Save choco0908/6a8f00998dfe800a9455085125744eba to your computer and use it in GitHub Desktop.
현재 내 위치 참조하기 코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getLocation() { | |
if (navigator.geolocation) { // GPS를 지원하면 | |
navigator.geolocation.getCurrentPosition(function(position) { | |
alert(position.coords.latitude + ' ' + position.coords.longitude); | |
}, function(error) { | |
console.error(error); | |
}, { | |
enableHighAccuracy: false, | |
maximumAge: 0, | |
timeout: Infinity | |
}); | |
} else { | |
alert('GPS를 지원하지 않습니다'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment