JSFiddle - React, Tailwind, and code Playground
HTML
<p id="location"></p>
JavaScript
if(typeof navigator.geolocation.watchPosition == "function"){
navigator.geolocation.watchPosition(
function(position){
var msg = 'Zeit: ' + position.timestamp + '<br>' +
'Geographische Breite: ' + position.coords.latitude + '<br>' +
'Geographische Länge: ' + position.coords.longitude + '<br>' +
'Höhe: ' + position.coords.altitude + '<br>' +
'Präzision: ' + position.coords.accuracy + '<br>' +
'Präzision der Höhenmessung: ' + position.coords.altitudeAccuracy + '<br>' +
'Richtung: ' + position.coords.heading + '<br>' +
'Geschwindigkeit: ' + position.coords.speed + '<br>';
document.getElementById('location').innerHTML = msg;
},
function(error){
alert("Fehler " + error.code + ": " + error.message);
}
);
}
else{
alert("Dein Browser ist zu schlecht :(");
}