Skip to content

Instantly share code, notes, and snippets.

@stenrdj
Last active September 20, 2017 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stenrdj/c30a9a833df2c0c0292cffe79539e14f to your computer and use it in GitHub Desktop.
Save stenrdj/c30a9a833df2c0c0292cffe79539e14f to your computer and use it in GitHub Desktop.
JS - Navigator geolocalisation longitude and latitude
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