Return to Snippet

Revision: 21220
at December 7, 2009 04:55 by hellofromdan


Initial Code
<script type="text/javascript">
		if(google.loader.ClientLocation)
		{
			visitor_lat = google.loader.ClientLocation.latitude;
			visitor_lon = google.loader.ClientLocation.longitude;
			visitor_city = google.loader.ClientLocation.address.city;
			visitor_region = google.loader.ClientLocation.address.region;
			visitor_country = google.loader.ClientLocation.address.country;
			visitor_countrycode = google.loader.ClientLocation.address.country_code;
			document.getElementById('yourinfo').innerHTML = '<p>Lat/Lon: ' + visitor_lat + ' / ' + visitor_lon + '</p><p>Location: ' + visitor_city + ', ' + visitor_region + ', ' + visitor_country + ' (' + visitor_countrycode + ')</p>';
		}
		else
		{
			document.getElementById('yourinfo').innerHTML = '<p>Whoops!</p>';
		}

Initial URL
http://briancray.com/2009/05/29/find-web-visitors-location-javascript-google-api/

Initial Description
must also load "http://www.google.com/jsapi?key=ABQIAAAAp04yNttlQq-7b4aZI_jL5hQYPm-xtd00hTQOC0OXpAMO40FHAxQMnH50uBbWoKVHwgpklyirDEregg" as a javascript

Initial Title
Visitor Location

Initial Tags


Initial Language
JavaScript