Click to See Complete Forum and Search --> : JavaScript to get users ip address?


WhataNoob
03-05-2003, 07:46 AM
Is there any was for javascript (in the html page - not serverside) to get the users ip address? I have found various codes, but none of them work.

PLEASE HELP!

Thanks in advance.

pyro
03-05-2003, 07:48 AM
I think that the only way this has really ever worked is in old verions of Netscape, with Java enabled.... So, it has to be done server side.

khalidali63
03-05-2003, 08:03 AM
if java enabled the newer versions of NS can get the ip address as well,old or new ,the code to get ip address is java code,
JavaScript does not get this doen by any means..

:p

Khalid

pyro
03-05-2003, 09:33 AM
Ah, you are probably right. I thought there was a hack for NN4.x to get an IP with javascript... But, I can't find it, so maybe not. :D

khalidali63
03-05-2003, 09:57 AM
Since we are talking about it,
here is the java code that gets this info..

:D


if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) {
var inet=java.net.InetAddress.getLocalHost();
var host=inet.getHostName();
var ip=inet.getHostAddress();
alert("Your host name is '" + host + "'\nYour IP address is " + ip);
}

pyro
03-05-2003, 10:25 AM
Just out of curiosity. I see you've got a != to IE in there. Can't Java get the IP of IE users?

khalidali63
03-05-2003, 10:30 AM
it should be able to do that if IE has java jvm linked to it( java enabled),
as you know that MS has its on jvm

Khalid.

pyro
03-05-2003, 10:33 AM
Originally posted by khalidali63
as you know that MS has its on jvmlol...Yes I know all about that. :D

Code One
03-05-2003, 10:13 PM
now hell be terrorizing the web, oooohhhhh aaaahhhhhhh

its curtains I tell you CURTAINS!

Code One