Get Geo-Location Data

by Erica Mitchell

HTML

<div id="data">
  <h4>You are here:</h4>

</div>

JavaScript

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      $("#data").html("latitude:" + position.coords.latitude + "<br>longitude:" + position.coords.longitude);
    });
  }