W3C Geolocation API in IE9

February 17th, 2011

IE9 RC includes support for the W3C Geolocation API, which enables Web developers to request the user’s physical location. This capability is useful for many Web sites, especially those that are already location-aware. For example, mapping services can now center the map based on where you actually are. Sites that let you check in can recommend nearby places. Local search can work more reliability.

Internet Explorer respects your privacy. With your permission, Web sites can obtain your approximate latitude and longitude by calling one of the W3C Geolocation API methods. If a Web site requests your location, Internet Explorer will notify you and let you choose whether or not to grant the requesting Web site access to your location. You can allow or deny the Web site access to your location once, or you can always allow or deny by clicking on the “Options for this site” button. At any time, you can clear the list of sites you have allowed or denied access to on the Privacy tab in Tools->Internet Options. On that tab, you can also turn off geolocation and prevent any Web site from requesting your location.

If you allow, Internet Explorer will approximate your location with the help of the Microsoft Location Service and works without the need for additional hardware. Given an IP address or a list of nearby WiFi hotspots, it can approximate your physical location using a database of IP addresses and a database of known hotspot locations.

You can try out this capability on the IE9 Test Drive site. Just click “locate me,” approve the prompt, and check out the result. If you zoom out, you can see the error radius that is returned by the API. You’ll notice that location requests with WiFi data are more accurate than those based just on IP address.

In a future post we’ll get into some useful code samples that demonstrate how to integrate this capability into your Web site. Until then, you can check out the Geolocation Demo on the IE Test Drive site.

—Andy Zeigler, Program Manager, Internet Explorer