Skip to content

Instantly share code, notes, and snippets.

@macmladen
Created October 8, 2023 13:47
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 macmladen/48f41c84b9ac22762b98e3bd3feb12c1 to your computer and use it in GitHub Desktop.
Save macmladen/48f41c84b9ac22762b98e3bd3feb12c1 to your computer and use it in GitHub Desktop.
// International data based on browser preference
Intl.DateTimeFormat().resolvedOptions()
// Timezone offset to UTC
(new Date()).getTimezoneOffset()
// Array from browser
navigator.languages
// Language Attribute if page has it
document.querySelector('html').getAttribute('lang')
// Use Geolocation API
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
// getCurrentPosition(success, error, options)
navigator.geolocation.getCurrentPosition(console.log)
// Reverse geolocate lat/long
https://geocode.maps.co/reverse?lat=55.7086421&lon=13.188364
// Google API
// https://stackoverflow.com/a/41276025/1099667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment