Where am I?

This page will attempt to find your current location. If you want to try again, then press the button


Each time you press the button, a new row of location data will be added here

This shows how to use various APIs to try to find the location of the user of your website. It tries several techniques to find the user's location, starting with the most precise and then moving onto less precise methods.

First it will try to use the W3C geolocation standard. At time of writing this is supported in the latest versions of the main browsers and seems to be very accurate sometimes and reasonably accurate other times (even from the same location). The only problem with it is that it asks the user for permission before proceeding, which means you'll need a fallback solution if the user says no.

If that doesn't work, it will attempt to use the Google loader API. This should work in any browser but appears to be based on the user's IP address, so accuracy is pretty hit and miss (if it works at all).

Finally, the location will be guessed based on the user's locale. This is pretty inaccurate and may be completely wrong, if the user has set their locale to something not related to their actual location. My mapping of locales to locations is not complete so this method also may not work at all.

Finally, these are the results of my tests of this functionality on various browsers on Windows.
Browser API supported
Internet Explorer 9+ W3C (Google loader in compatibility view)
Internet Explorer 6-8 Google loader
Chrome 50+ W3C over HTTPS, Google loader over HTTP
Chrome 9 - 49 W3C
FireFox 3.6+ W3C
Safari 5 W3C
Opera 11 W3C