MediaWiki:Common.js: Difference between revisions
(Created page with "→Any JavaScript here will be loaded for all users on every page load.: →Extract LAT/LON from capable browsers: var x = document.getElementById("ShowLatLonHere"); function getLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported by this browser."; } } function showPosition(position) { x.innerHTML = "Lat: " + position.coords.latitude + "<br>Lon: "...") |
(No difference)
|
Latest revision as of 16:38, 4 August 2022
/* Any JavaScript here will be loaded for all users on every page load. */
/* Extract LAT/LON from capable browsers */
var x = document.getElementById("ShowLatLonHere");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Lat: " + position.coords.latitude +
"<br>Lon: " + position.coords.longitude;
}