unexpected problem with google.loader.ClientLocation

Showing 1-7 of 7 messages
unexpected problem with google.loader.ClientLocation Emmanuel Jacquart 9/30/10 5:06 AM
I have a problem using the google AJAX API on my website. I wrote a
code that worked till yesterday. I don't understand why it doesn't
work anymore. I just use the google.loader.ClientLocation and my debug
shows me that this variable is always null.
Here is an extract of my code (I checked the google.loader that is
charged, my key is valid and recognized) :
<script type="text/javascript" src="http://www.google.com/jsapi?
key=MY_KEY
"></script>
<script language="Javascript" type="text/javascript">
jQuery(document).ready(function () {

if(google.loader.ClientLocation)
    {
        visitor_country =
google.loader.ClientLocation.address.country;
     ...

Have you any idea about this problem?

Re: unexpected problem with google.loader.ClientLocation jgeerdes [AJAX APIs "Guru"] 9/30/10 5:52 AM
google.loader.ClientLocation returns null when Google is unable to geocode your IP address. Since this is a very inexact science due to the dynamic nature of the vast majority of IP addresses on the planet, the ClientLocation functionality should not be relied on for mission-critical applications. Rather than depending on it, I would suggest checking first for navigator.geolocation and then, since you're looking for the country, reverse geocoding the coordinates via the GMaps' geocoding service.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-search-api+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Re: unexpected problem with google.loader.ClientLocation Emmanuel Jacquart 9/30/10 7:51 AM
Thank you for the response, I'd just like to keep my code because it
worked last week but I changed nothing before the problems arrives. I
checked with differents computers, with differents IPs address and
configuration (with or without proxy). Can we explain that the API
doesn't answer anymore? Could someone confirm me that
google.loader.ClientLocation still works fine?
Re: unexpected problem with google.loader.ClientLocation jgeerdes [AJAX APIs "Guru"] 9/30/10 7:53 AM
The ClientLocation feature worked great for me for a long time, but then stopped months ago. Since then, there have been a couple of times when it worked, but it is highly unreliable.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-search-api+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Re: unexpected problem with google.loader.ClientLocation Emmanuel Jacquart 9/30/10 8:10 AM
Thank you another time for the precisions. I didn't know that this
feature was so unreliable.

Re: unexpected problem with google.loader.ClientLocation jgeerdes [AJAX APIs "Guru"] 9/30/10 8:24 AM
Yeah, it's one of those things the Googlers don't exactly advertise :) Since you mentioned that you would like to keep your existing code, you could check for the availability of ClientLocation and, if it's not there, use the navigator.geolocation functionality of modern browsers as I described in my previous post.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jrge...@gmail.com

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Sep 30, 2010, at 10:10 AM, Emmanuel Jacquart wrote:

> Thank you another time for the precisions. I didn't know that this
> feature was so unreliable.
>
> --
> You received this message because you are subscribed to the Google Groups "Google AJAX APIs" group.
> To post to this group, send email to google-ajax...@googlegroups.com.
> To unsubscribe from this group, send email to google-ajax-search-api+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-ajax-search-api?hl=en.
>

Re: unexpected problem with google.loader.ClientLocation omr 9/30/10 3:36 PM
This documentation may be of interest:

http://code.google.com/apis/maps/documentation/javascript/basics.html#DetectingUserLocation

Quoted from that documentation:

> "... As a user's IP address can only provide a rough estimate of a user's location, we don't recommend using this approach for geolocation. The W3C approach is the easiest and most fully-supported so it should be prioritized over other methods. ..."

See the code sample given there.
See also this complete and revised version of that sample:

http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html

See also this alternative sample:

http://gmaps-samples-v3.googlecode.com/svn/trunk/geolocate/geolocate.html

-- omr