Getting IP Address


/ Published in: JavaScript
Save to your folder(s)

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:


Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. var ip = '<!--#echo var="REMOTE_ADDR"-->';
  3. document.write('Your IP address is: ' + ip);
  4. </script>

URL: http://www.apphp.com/index.php?snippet=javascript-getting-ip-address

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.