W3C Geolocation API (HTML5)

I have fiddled a little bit with the W3C Geolocation API and made the below demo on how to detect the user’s location within a browser. The demo uses HTML5 and the Google Maps API V3, which is designed to load faster, especially on mobile browsers such as Android-based devices and the iPhone.

Currently, several ways exist to detect the user’s location within a browser. None of these methods are part of the Google Maps API; instead, they are common industry standards.

Newer browsers are starting to support the W3C Geolocation standard. This standard is part of HTML5 and will likely become the de-facto standard going forward. All applications that wish to perform geolocation should support this standard.

Some browsers with Google Gears can use Google Gears Geolocation API. Since widespread support for the W3C standard is still forthcoming, checking for Gears is a good fallback mechanism.

Some browsers use IP addresses to detect a user’s location, though this provides only a very rough estimate.