All I want to do is find out the person IP address so that I can reverse geocode it to find out their latitude and longitude from which they are viewing my web site from.
I can do that using Google ClientLocation API but it's unclear to me if I have to load the huge Google Map framework just to use it.
Is it possible to simply use the ClientLocation API without having to load all of Google Maps? If so, how?
Yes, you only need to use the ClientLocation object in the google.loader namespace so you need not reference the maps api or anything else. For example.
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script language="javascript">
if (google.loader.ClientLocation != null) {
alert(google.loader.ClientLocation.address.city);
} else {
alert("Not found");
}
</script>
The properties available are
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With