How to use the Geolocation API

Tagged geolocation, firefox  Languages javascript

Firefox 3.1 supports the geolocation API specification.

Try copying this code and running it in Firebug:

function showMap(position) {
  // Show a map centered at (position.coords.latitude, position.coords.longitude).
  console.dir(position);
}

navigator.geolocation.getCurrentPosition(showMap);