Rex wrote on 30 jun 2006 in comp.lang.javascript
:
Hi all,
I need to get the IP address of client machines
from inside Mozilla, Netscape, and IE.
Many webpages say to use in Netscape 4+
the expression
var ip = java.net.getLocalhost.getIpAddress()
That is java, not javascript
This for me always returns 127.0.0.1.
·. and indeed that is usually the ip of the localhost.
Is this a bug or should I get trying to retrieve
an array of addresses and then scan that?
The client IP adress is only available to the server
and to serverside code, I think,
and not to the client and it's code.
So using serverside j[ava]script under ASP it is simple:
<%
response.write(request.servervariables("remote_add r"));
%>
But then, the IP address is sometimes/usually not the machine address,
but the nat-router or the proxy address.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)