Skip to content

Instantly share code, notes, and snippets.

@rslahmed
Last active October 23, 2020 14:53
Show Gist options
  • Save rslahmed/5a4c6e5e6fd27dd5cb4c7989b9052d88 to your computer and use it in GitHub Desktop.
Save rslahmed/5a4c6e5e6fd27dd5cb4c7989b9052d88 to your computer and use it in GitHub Desktop.
Get location with geolocation
//get latitude and longitude
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position) {
console.log(position.coords.latitude, position.coords.longitude)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment