/* eslint-disable no-unsanitized/property */ function success(position) { let message = document.getElementById("status"); message.innerHTML = ""; message.innerHTML += "
Longitude: " + position.coords.longitude + "
"; message.innerHTML += "Latitude: " + position.coords.latitude + "
"; message.innerHTML += "Altitude: " + position.coords.altitude + "
"; } function error(msg) { let message = document.getElementById("status"); message.innerHTML = "Failed to get geolocation."; } if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success, error); } else { error("Geolocation is not supported."); }