Shows your current location coordinates using the Geolocation API.
See this tutorial for more details.
Shows your current location coordinates using the Geolocation API.
See this tutorial for more details.
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, | |
minimum-scale=1.0"> | |
<style> | |
html { | |
margin: 80px; | |
font-family: "Helvetica Neue"; | |
font-weight: 100; | |
font-size: 100px; | |
color: #999; | |
} | |
</style> | |
<div id="lat">Latitude</div> | |
<div id="lon">Longitude</div> | |
<script> | |
navigator.geolocation.watchPosition(render); | |
function render(pos){ | |
lat.innerText = pos.coords.latitude.toFixed(7); | |
lon.innerText = pos.coords.longitude.toFixed(7); | |
} | |
</script> |