-1

How to get browser IP address and the visitors country, who visited my site, without doing any API call. suppose that my site is www.xyz.com. and anyone is putting my site url in browser address bar. on hiting my url, i should get browser IP address and the visitors country.

  • 2
    Is it a duplicate if the OP explicitly excludes the first answer on the duplicate question, but didn't bother to scroll down to the second answer?: https://stackoverflow.com/a/32841164/328193 That's for IP address at least. "Country" doesn't seem as likely to be findable. – David Jun 20 '18 at 14:17
  • Possible duplicate of [How to get client's IP address using JavaScript?](https://stackoverflow.com/questions/391979/how-to-get-clients-ip-address-using-javascript) – Derek Brown Jun 20 '18 at 14:37

1 Answers1

1

That is not possible. The browser is not aware of the public ip address he uses.

To get the country you can look at the language (How to get the browser language using JavaScript) and try to get the users geolocation (https://www.w3schools.com/Html/html5_geolocation.asp)

Franziskus Karsunke
  • 4,948
  • 3
  • 40
  • 54