google map : get user's location like google

110 Views Asked by At

I would like to center a gmap to the user's location. Like google map itself, when you're going on maps.google.com, the center is our own location.

I found this http://www.w3schools.com/html/html5_geolocation.asp but like the tuto says, the user has to approve it because this code give you the exact lat and lng.

But google map doesn't ask this (or maybe?), maybe because the position isn't very sharp, and only shows the city and not the exact position ? This is what i want to do, get an approximate position and center the map to the city where the user is located + the cities around is enough, i don't want to know where the user is exactly located.

im using javascript

Can you help me ?

Thanks

1

There are 1 best solutions below

0
On

I recommend a website www.iptolatlng.com which is available for US users only, but there are other sites like it that will provide approximate location in latitude/longitude based on IP address.

http://www.telize.com/ is another one since the first link seems to no longer work.