how to get the IP of the browser in react code example
Example: how to get user ip address in javascript
// You can't extract the the public ip from with in the browser
// but you CAN use a third party, there are a lot of them out there
// I use www.ipify.org/
// because, according to them:
//
// 1. You can use it without limit (even if you're doing millions of
// requests per minute).
// 2. ipify is completely open source (check out the GitHub repository).
//Here's a WORKING JS EXAMPLE:
<script>
function getIP(json) {
alert("My public IP address is: " + json.ip);
}
</script>
<script src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
// as seperate script tag
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"> </script>