faqts : Computers : Programming : Languages : JavaScript : DHTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 75 people (8%) answered Yes
Recently 0 of 10 people (0%) answered Yes

Entry

How can I get the user's computer name?

Apr 29th, 2001 00:34
Colin Fraser, Richard Brennan,


I am not sure you can for a number of reasons. The main one for me would 
be "Why would you want to?" As a developer, even if you are only 
developing your own pages and never work commercially, you are still 
obligated to respect the privacy of another user. Added to that is the 
idea that if you could get such information then what other information 
is really available to you from the user's computer? Does this not make 
any computer vulnerable? My word it does. How would you feel about one 
of Bill Gates' Sith lords rooting around inside your computer checking 
out your software, or maybe a Borg trying to sell you a new router 
because they can see you don't have one and they can see you have 
networked your old computer to your new one.   
However, if you are wanting to get the user's name you can always ask, 
try an alert : 
<body>
<SCRIPT LANGUAGE="javascript">
//This script prompts a user for their name and writes it to the page 
    var username = prompt ("Please write your name below","Here, thank 
you");
    document.write("Hello " + username + ", and welcome");
</SCRIPT> 
Rest of page goes here.