[Tutor] JS for location detection

Gaurav Kalra gvkalra at gmail.com
Sun Jun 6 20:29:32 CEST 2010


Hi all,

I was trying to get the user location based on 4 levels.
1. Try for Navigator telling the location (W3C recommendations followed)
2. In case the location is not available, fallback on Google Gears
3. Again if not available, fall back on Google Ajax API's (only for US)
4. Again if not available, use IP to location using Max-Mind Database

The code that I have written is here:
http://github.com/gvkalra/random/blob/master/static/js/map.js

The problem I am facing:
If the navigator supports location sharing, it will ask the user whether it
wants to approve or not (that's okay!). If the user says NO, it is giving me
the right result by falling back on 3/4 step. But, in case the user
approves, the results are not being populated.

Please check the code for more details (commented inline). Any suggestions ?

--
With Thanks
Gaurav Kalra
+91-9717-620-649
gvkalra at googlemail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100606/a706c6cb/attachment.html>


More information about the Tutor mailing list