Getting local IP address in javascript?

Is there a way to get the visitors local IP-address in javascript? I mean his LAN address like 192.168.1.x, not his regular IP-address.

I found several approaches that attempt to do this, but they either give me the external (regular) IP address, or they give 127.0.0.1 which doesn’t really tell me anything. I need the local network address.

Just an alert saying “your machine’s local network IP is 10.0.0.139” would be great.

The only language I know of that JavaScript can use to get IP addresses that might have access to be able to get that one is Java. You’d need the Java to be running in the browser for it to have access to that IP address.

I don’t know if Java has access to that address to be able to pass it to JavaScript but it is certain that none of the languages running on the server that can pass an IP address to JavaScript will be able to get that address so Java is the only possibility.

Thanks for your reply. Yes, certainly no server-sided language or script will ever be able to get my local IP, so that would leave Java or Javascript the only possible candidates.

Someone else suggested a method for calling static Java packages from within Javascript, but that didn’t seem to work so far.

Would you (or anyone else) have any idea how to go about this?? I’m really stuck with this…

I do have the latest Sun Java installed so that shouldn’t be a problem.

This link might do it for you.
http://javascript.internet.com/user-details/ip-address.html

Unfortunately this only gives the external (regular / global) IP, which is trivial.

I need their internal, local network IP, like “10.x.x.x” or “192.168.x.x”, any idea how to get that?

It doesn’t neccessarily have to be javascript, any other language would be fine too (although it’d have to run client-side obviously, so that’d narrow it down to JS or Java I guess).

I just tried that code and it did NOT give the correct IP address. It told me the IP address of my internet connection and not that of my computer. That’s because it is using server side code to get the IP address - SSI in that example.

The only way that you might be able to get the local IP address is via Java running in the browser. JavaScript itself has no access to get the IP address and neither does anything running on the server.

The following JavaScript call to Java retrieves an IP address but I don’t think it iis the one you want but at least you might be able to figure out what modification is needed to this to retrieve the IP address that you actually want.

if (java && java.net)
ip = ''+java.net.InetAddress.getLocalHost().getHostAddress();
else ip = 'unknown';

Alternatively, I just found out that it is possible to do it entirely with Java - as http://www.proxyblind.org/javaipp.shtml demonstrates.