Hacker News new | ask | show | jobs
by ryanmahoski 5272 days ago
Your best bet is html5 geolocation + modernizr.js + a shim. Browsers that support html5 geolocation will return highly accurate results while those that don't support it will fall back to calling the google maps api (ip to geo).

https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Brow...

1 comments

HTML5 Geolocation requires people to opt-in, which is pretty messy.

Better off getting the free version of the MaxMind city database[1] and running it on a server somewhere.

[1] http://www.maxmind.com/app/geolitecity

The opt-in button is messy but results are very precise and reliable. Some use cases warrant it, some do not. Maxmind claims 79% accuracy on a city level: is the google api worse? All other things being equal I would be inclined to pick the one that didn't require me to frequently install binary patches or update a database.
But I agree with you, it's a ux dealbreaker for most situations. Solution: control the hardware. :)