Problem with google.loader.ClientLocation

9 views
Skip to first unread message

Saurabh

unread,
Nov 5, 2009, 12:09:09 PM11/5/09
to Google AJAX APIs
I am Using Google maps api. I cann't find the user location through
the given google.loader.ClientLocation. The code is given below:

<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABQIAAAAgOuXEvTk7QnQbBVewfG-1BR76dHLW_FiRzipF_h-
YwlJavwRiBSQ0UThRPEca2hcF0vgGxkb-XpEYg"></script>//localhost key


<script language="javascript" type="text/javascript">


google.load("maps", "2.x");

google.load("search", "1");

google.setOnLoadCallback(function() {

if (google.loader.ClientLocation)

{


var cl = google.loader.ClientLocation;

var location = [cl.address.city, cl.address.region,
cl.address.country].join(', ');

document.getElementById('hdnlongitude').value=cl.longitude;

document.getElementById('hdnlatitude').value=cl.latitude;

alert("Welcome to our visitors from "+ cl.longitude +' '+cl.latitude+'
'+location);

}


});

</script>



Everytime --"google.loader.ClientLocation" it is null.

Please help me asap

skylar....@gmail.com

unread,
Nov 5, 2009, 5:27:42 PM11/5/09
to google-ajax...@googlegroups.com
Not everyone may be located using that function. But, speaking of functions, don't you have to call it?

Might be wrong, just killing time at the airport ;)

Sent from my Verizon Wireless BlackBerry
Reply all
Reply to author
Forward
0 new messages