What is the right way to use geolocation for desktop PCs?
Different geolocation demos show very different results when it comes to detecting my location.
I'm from France, Bordeaux, and expecting at least the city to be shown. Unfortunately, in most cases the city is wrong, and corresponding probably to the location of the servers of the ISP.
Here are the results taken at the same moment from three of top five Google "geolocation ip" results:
http://www.ip2location.com/ - wrong answer
http://www.ipligence.com/geolocation - another, different wrong answer
http://www.infosniper.net/ - right answer
Even if the last one, on the very home page, ensures that I have an error in my SQL syntax, it is at least the only website that displayed the right location among those开发者_运维百科 I've tried.
None of the three websites use HTML5, unlike Google Maps. Google Maps, using HTML5, seems to get the right city too.
- How those non-HTML5 websites get a location of a desktop PC?
- Why most of them are totally wrong?
- How to get it right?
How those non-HTML5 websites get a location of a desktop PC?
Looking up your IP address against a database which maps IP addresses to locations.
Why most of them are totally wrong?
Because they have wrong data in the database.
How to get it right?
Ask the user.
The only reliable IP to location database is maxmind
Try the following and you will see : http://www.maxmind.com/app/mylocation
This is the same database that adult ads makers are using to show you that the same girl live in your city, even if you move :-)
In the examples you gave, one is simply using an updated database.
In reality, Firefox and Google Chrome, and maybe other browsers, can also rely on Wi-Fi triangulation for determining the user's location, if the computer supports Wi-Fi. This is especially the case for most recent laptops, phones, and tablets.
精彩评论