Is it possible to get user location information through your ip?

Asked

Viewed 102 times

3

Is there any possibility using the schedule of getting locations from a supposed visitor to your website?

Example: "So-and-so" with ip: 192.168.254.1 visited my website: www.meusite.com.br

Through this obtained ip can I accurately determine geographic information of such user? The location details I refer to are the country, the state, to city and if possible the neighborhood.

I want to know if through programming (language independent) I can get such data from a visitor of my site.

1 answer

0

function getLocation(){
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{
    alert("O seu navegador não suporta Geolocalização.");
    }
}

function showPosition(position){
   alert("Latitude: " + position.coords.latitude + " Longitude: " + position.coords.longitude);  
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.