Web Development

General discussion


Novice question

By joncr ·
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?

<script language="JavaScript">


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by joncr In reply to Novice question

Browser is fully patched IE6 by the way.

Collapse -

by Martin Simons In reply to Novice question

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.

Collapse -

by Martin Simons In reply to

sorry to say this, but can't be done this way. See the following site:

Collapse -

by joncr In reply to Novice question

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

Collapse -

by zilaq In reply to Novice question

Check this link:


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).

Collapse -

by tarnishedknight In reply to Novice question

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.

Related Discussions

Related Forums