JSFiddle - React, Tailwind, and code Playground
by Sir_Pepe
HTML
<pre id="Location">Position erscheint hier!</pre>
JavaScript
navigator.geolocation.watchPosition(function(position){
var msg = "Zeit: " + position.timestamp + "\n" +
"Geographische Breite: " + position.coords.latitude + "\n" +
"Geographische Länge: " + position.coords.longitude + "\n" +
"Höhe: " + position.coords.altitude + "\n" +
"Präzision: " + position.coords.accuracy + "\n" +
"Präzision Höhenmessung: " + position.coords.altitudeAccuracy + "\n" +
"Richtung: " + position.coords.heading + "\n" +
"Geschwindigkeit: " + position.coords.speed + "\n";
document.getElementById("Location").innerHTML = msg;
},
function(error){
alert("Fehler " + error.code + ": " + error.message);
}
);