~/snippets/Geolocation
Published on

Geolocation

156 words1 min read–––
Views
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function (position) {
    var lat = position.coords.latitude,
      lon = position.coords.longitude
    console.log('Geolocation - Latitude: ' + lat + ', Longitude: ' + lon)
  })
} else {
  console.log('Geolocation is not supported for this Browser/OS version yet.')
}