Discussion Locked

Novice question

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I've got this code in an intranet webpage to display the computer name of the client but when I open it in IE (or frontpage locally) I get an error saying that "java" (line 2)is not undefined. The code is taken from a tutorial web page. Can anyone help?

6 replies

by martin simons

It sounds as though you have not enabled java in your browser. Also, in the write statement, yhost should not be enclosed in quotes if you want it to actually print the hostname.

by joncr

Thanks, the "yhost" was in there from when I was debugging. I've reinstalled the runtime and its still not working.

by zilaq

Check this link:

http://javascript.internet.com/user-details/hostname.html

They have a code similar to yours and they say this works only in netscape browsers. Personally I don't know if this is true, but I think that if it were possible to find the address of a computer, this would pose a security risk. So I think with Windows XP SP2 this is not possible in IE. At least on my computer (WIN XP SP2, IE 6.0.290) this does not work (and I hope it will never work).

by tarnishedknight

Sorry but you cant do this kind of thing client side it is not allowed. What will work however is server side scripting like CGI, perl or ASP. If you have a server that supports server side scripting you can extract the IP address (for example using the CGI variable "Remote_Addr") and display it back to the user.

This discussion is closed to new replies.