Getting a visitor's location (city)

·
Javascript, IP address-based lookup:

Google

<script src="http://www.google.com/jsapi"></script>
<script>
var l = google.loader.ClientLocation;
console.log(l.address.city);
console.log(l.address.region);
console.log(l.address.country);
console.log(l.latitude);
console.log(l.longitude);
</script>

London, Surrey, United Kingdom
51.5, -0.117

MaxMind

<script src="http://j.maxmind.com/app/geoip.js"></script>
<script>
console.log(geoip_city());
console.log(geoip_region_name());
console.log(geoip_country_name());
console.log(geoip_latitude());
console.log(geoip_longitude());
</script>

London, London, United Kingdom
51.5000, -0.1167