Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   General Discussions (http://forums.winamp.com/forumdisplay.php?f=1)
-   -   Javascript internet explorer important (http://forums.winamp.com/showthread.php?t=174574)

omarello 29th March 2004 12:42

Javascript internet explorer important
 
hi all,

please help me on this, it is really important.

i need to get the ip address of client accessing my jsp page for a project my company is working on. i have succefully retreived the ip but only on netscape, i have read around and founf that it is not possible with IE, but i need to confirm this.

is there any way i can get the ip address using javascript or even java or anything?????

here is what i used to get the ip address

code:

<script>
window . onerror = null;

hostaddress = hostname = "(unknown)";

localhost = java . net . InetAddress . getLocalHost ();
hostaddress = localhost . getHostAddress ();
hostname = localhost . getHostName ();
</script>

<script>

document . writeln ("<p>Your IP address is <b>" + hostaddress + "</b>.</p>");
document . writeln ("<p>Your hostname is <b>" + hostname + "</b>.</p>");

</script>



thats the script i have in my jsp page
and running TOMCAt 4.0
thanx a lot

Russ 29th March 2004 12:55

Err, I'm not entirely sure what you're doing there. If you're using JSP it should be as easy as:

code:

<%
System.out.println("<p>Your IP address is <b>" + request.getRemoteAddr() + "</b>.</p>");

System.out.println("<p>Your hostname is <b>" + request.getRemoteHost() + "</b>.</p>");
%>


omarello 29th March 2004 13:12

hehe i know i just did the same thing as soon as i posted the thread, hehe i was like i am an idiot, cause i was thinking of javascript i forgot that i could just use the request object.

neways thanx a lot.

i just realized that there is no way to do it using javascript only.. unless u are running netscape.

thanx a lot.

omarello

mark 29th March 2004 15:52

I was about to say welcome back, but It seems you never left...

For a major dude dating back 3 years, I never noticed you...


All times are GMT. The time now is 20:16.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.