Last active
May 19, 2020 18:01
-
-
Save pointofpresence/81fbc90065eca11a04487ee060d306c6 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
This file contains hidden or 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
var options = { | |
enableHighAccuracy: true, | |
timeout: 5000, | |
maximumAge: 0 | |
}; | |
function success(pos) { | |
var crd = pos.coords; | |
console.log('Your current position is:'); | |
console.log('Latitude : ' + crd.latitude); | |
console.log('Longitude: ' + crd.longitude); | |
console.log('More or less ' + crd.accuracy + ' meters.'); | |
}; | |
function error(err) { | |
console.warn('ERROR(' + err.code + '): ' + err.message); | |
}; | |
navigator.geolocation.getCurrentPosition(success, error, options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment