The implementation I currently use I've seen in a couple other questions, but I haven't seen it as the selected answer.
I've detailed this in my blog thenullreference.com, but here it is in short:
Essentially all you need to do is load Google's API loader script:
<script type="text/javascript" src="http(s)://www.google.com/jsapi"></script>
Then you have access to several properties that give you detailed location info.
The object you want to look at is google.loader.ClientLocation
- ClientLocation.latitude
- ClientLocation.longitude
- ClientLocation.address.city
- ClientLocation.address.country
- ClientLocation.address.country_code - ISO 3166-1 country code
- ClientLocation.address.region - country specific region in US this is state
*Note some of these can be null
For more info on this API check out here
Does anyone else use this? Does anyone have something that they use that is as simple and better? Are there issues with this approach?
I'm unaware of the coverage/accuracy of this solution, but I would think that Google keeps it updated and is probably pretty good.