JSFiddle - React, Tailwind, and code Playground
by Alex Alex
JavaScript
var geoConfig = {
enableHighAccuracy: false,
maximumAge : 1000,//10 min
timeout : 60000//1 min
};
function errorHandler(error) {
alert('Error: ' + error.code + '. ' + error.message);
}
function successHandler (position) {
alert(position.coords);
alert(JSON.stringify(position));
}
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(successHandler, errorHandler, geoConfig);
} else {
alert('There is no geolocation support!')
}