Old 29th March 2004, 12:42   #1
omarello
Major Dude
 
omarello's Avatar
 
Join Date: Feb 2001
Location: ---- Montreal ---- Canada ----
Posts: 529
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

Shoot me again I ain't dead YET
omarello is offline   Reply With Quote
Old 29th March 2004, 12:55   #2
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
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>");
%>


For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline   Reply With Quote
Old 29th March 2004, 13:12   #3
omarello
Major Dude
 
omarello's Avatar
 
Join Date: Feb 2001
Location: ---- Montreal ---- Canada ----
Posts: 529
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

Shoot me again I ain't dead YET
omarello is offline   Reply With Quote
Old 29th March 2004, 15:52   #4
mark
Forum King
 
mark's Avatar
 
Join Date: Jul 2002
Location: Norn Ir'nd, leek...
Posts: 6,287
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...
mark is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Community Center > General Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump