I've got a function on my webpage that gets the user's geolocation. How do I automatically load the latitude and longitude into an input box when the page loads without using the OnClick function?
function showlocation() {
// One-shot position request.
navigator.geolocation.getCurrentPosition(callback);
}
function callback(position) {
document.getElementById('latitude').innerHTML = position.coords.latitude;
document.getElementById('longitude').innerHTML = position.coords.longitude;
}