img src=https://res.cloudinary.com/dimaslanjaka/image/fetch/https://imgdb.net/images/4291.jpg class=w3-image title=JS Geolocation
Read How to async defer CSS JS perfectly
<script>
function locationSuccess(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var altitude = position.coords.altitude;
var accuracy = position.coords.accuracy;
var altitudeAccuracy = position.coords.altitudeAccuracy;
var heading = position.coords.height;
var speed = position.coords.speed;
var timestamp = position.timestamp;
// bekerja dengan informasi ini sesuka Anda!
}
function locationError(error) {
var code = error.code;
var message = error.message;
// baca kode dan pesan dan putuskan bagaimana Anda ingin menangani ini!
}
navigator.geolocation.getCurrentPosition(locationSuccess, locationError);
</script>