Posted By

apphp-snippets on 11/04/15


Tagged

javascript ip address


Versions (?)

Getting IP Address


 / Published in: JavaScript
 

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

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:

  1. <script type="text/javascript">
  2. var ip = '<!--#echo var="REMOTE_ADDR"-->';
  3. document.write('Your IP address is: ' + ip);
  4. </script>

Report this snippet  

You need to login to post a comment.