chromium/chrome/test/data/geolocation/geolocation_on_load.html

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>Show Geolocation on page load</title>
    <script>

function triggerGeo(onSuccess, onError) {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(onSuccess, onError); 
  } else {
    document.getElementById('lat').innerHTML =
        'Error: navigator.geolocation is false';
    document.getElementById('lng').innerHTML = '';
  }
}


function triggerGeoWithCallback(callback){
  triggerGeo(function (position){
    callback("allow");
  }, function(positionError){
    callback("block");
  });
}

function showPosition(position) {
  var lat = position.coords.latitude;
  var lng = position.coords.longitude;
  document.getElementById('lat').innerHTML = lat;
  document.getElementById('lng').innerHTML = lng;
  window.document.title = "Granted";
}

function showError(positionError) {
  document.getElementById('lat').innerHTML =
      positionError.message;
  document.getElementById('lng').innerHTML = '';
  window.document.title = "Denied";
}

    </script>
  </head>

<body onload="triggerGeo(showPosition, showError)">
<b id=lat>-1</b>, <b id=lng>-1</b>
</body>

</html>