Geo Location extracted from visitors ip address

Νίκος Gr33k nikos at superhost.gr
Sat Jul 6 16:51:52 EDT 2013


Στις 6/7/2013 11:32 μμ, ο/η Tim Chase έγραψε:
> Can you be more specific please about using the aforementioned
>> HTML5 location API ?
> https://www.google.com/search?q=html5+location+api
>
> It's client-side JavaScript.


so, i must edit my cgi script and do this:

print '''
<script>
var x=document.getElementById("demo");
function getLocation()
   {
   if (navigator.geolocation)
     {
     navigator.geolocation.getCurrentPosition(showPosition);
     }
   else{x.innerHTML="Geolocation is not supported by this browser.";}
   }
function showPosition(position)
   {
   x.innerHTML="Latitude: " + position.coords.latitude +
   "<br>Longitude: " + position.coords.longitude;
   }
</script>
'''

Will that do the trick?

but then again i want the city to be stored in the city variable.
Somehow the above javascript code mu return me a value that i will the 
store at variable "city".

I don't know how to do that.

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list