/ Published in: JavaScript
Sometimes you may want to show the visitor that you are aware of their IP address. You can do so by using few lines of code as shown here. Place the code in any place of your page, where you want the IP address to appear:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> var ip = '<!--#echo var="REMOTE_ADDR"-->'; document.write('Your IP address is: ' + ip); </script>
URL: http://www.apphp.com/index.php?snippet=javascript-getting-ip-address