I am trying to get customer ip address from my site(visualforce) page, trying to run the following javascript but unable to get the ip address. Any suggestion/improvements are appreciated, Thank you guys.
<script type="application/javascript">
var ipa;
function getIP(json) {
ipa = json.ip;
}
function setIp(){
document.getElementById('00Nc0000003r0ly').value = ipa;
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"> </script>
<body onload="setIp()">
<input id="00Nc0000003r0ly" maxlength="20" name="00Nc0000003r0ly" size="20" type="hidden"></input>