Geo Location with HTML5
I'm using this for http://rail.0gravity.co.uk/ with a sample application available for download.
if (navigator.geolocation) {
// Single query
navigator.geolocation.getCurrentPosition(renderPosition, renderError);
// Continuous
navigator.geolocation.watchPosition(renderPosition, renderError);
function renderPosition(position) {
/*
* Function to handle retrieving the results
*
* position.coords.
* latitude
* longitude
* accuracy
* altitude
* altitudeAccuracy
* heading
* speed
*/
}
} else {
// Geo-location is not supported - alert the user
}