Geolocation information from Browsers

HTML 5 has introduced a new feature - Browser Geolocation API. Now using a simple java-script code, you can extract the location information of visitors. This helps specially if you are providing location based information such as movie details, business listing, travel advisories and other such information.


if (navigator.geolocation) { // check if browse supports
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
// write your logic here
});
} else {
// HTML 5 Geolocation API are not supported by this browser.
}

Geolocation API is supported by Internet Explorer (IE) 9.0+, Firefox 3.5+, Google Chrome 5.0+, Safari 5.0+ and Opera 10.6+

The browser uses IP address and nearby wireless access points, and send to reliable location services (e.g Google Location Services) to determines the longitude and latitude. The accuracy defers from place to place.