Last active
September 20, 2017 10:40
-
-
Save stenrdj/c30a9a833df2c0c0292cffe79539e14f to your computer and use it in GitHub Desktop.
JS - Navigator geolocalisation longitude and latitude
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
if ("geolocation" in navigator) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
// Yes navigator got geolocation and you got permitions to use it | |
alert(position.coords.latitude, position.coords.longitude); | |
}); | |
} else { | |
alert('sorry your browser not support geolocalisation'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment