Pure Javascript Geolocation

JavascriptRead 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>