Gets coordinates on page load (long & Lat)

PHOTO EMBED

Fri Nov 18 2022 19:04:03 GMT+0000 (Coordinated Universal Time)

Saved by @Cchidozie #javascript #html

const findLocation = () => {
  const status = document.querySelectorAll('.status')

  const success = (position) => {
    console.log(position)
  }

  const error = () => {
    status.textContent = 'unable to get location'
  }

  navigator.geolocation.getCurrentPosition(success, error, {
    maximumAge: '10000',
    enableHighAccuracy: true,
  })
}

window.addEventListener('load', findLocation)
content_copyCOPY