GPS Locatie body { font-family: Arial, sans-serif; text-align: left; margin-top: 50px; } #location-box { display: inline-block; padding: 20px; border: 2px solid black; border-radius: 10px; font-size: 18px; margin-top: 0px; } #location { font-weight: bold; }
You are here: Locatie ophalen...
window.onload = function () { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition, showError); } else { document.getElementById("location").innerHTML = "Where are you?."; } }; function showPosition(position) { let lat = position.coords.latitude; let lon = position.coords.longitude; // OpenStreetMap API voor omgekeerde geocodering let url = `https://nominatim.openstreetmap.org/reverse?format=json&lat=${lat}&lon=${lon}`; fetch(url) .then(response => response.json()) .then(data => { let plaats = data.address.city || data.address.town || data.address.village || "Where are you?"; let land = data.address.country; document.getElementById("location").innerHTML = `${plaats}, ${land}`; }) .catch(error => { document.getElementById("location").innerHTML = "Where are you?"; }); } function showError(error) { switch (error.code) { case error.PERMISSION_DENIED: document.getElementById("location").innerHTML = "You know where you are."; break; case error.POSITION_UNAVAILABLE: document.getElementById("location").innerHTML = "Where are you?"; break; case error.TIMEOUT: document.getElementById("location").innerHTML = "A long way from home."; break; default: document.getElementById("location").innerHTML = "ERROR ERROR ERROOOORRR"; } }

This is not a website but a direct link to my computer please staY out of the files that are private thank you.