Return to Snippet

Revision: 70033
at November 4, 2015 19:08 by apphp-snippets


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

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

Initial Description
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:

Initial Title
Getting IP Address

Initial Tags
javascript, ip

Initial Language
JavaScript