faqts : Computers : Programming : Languages : JavaScript

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

1 of 93 people (1%) answered Yes
Recently 0 of 10 people (0%) answered Yes

Entry

How do I get the User Id of the logged on user from the client/browser?

Apr 6th, 2008 19:51
ha mo, Dave Clark, Colin Fraser, Jayaram H,


What you can do is ask for the User to put into a prompt their name if
you want to personalize pages. You can also use cookies to make 
frequent
visitors feel at home, but the real question is why would you want to? 
<SCRIPT LANGUAGE="javascript">
var username=prompt("Hello, please write your name in the box 
below","");
document.write("Welcome to my page, "+username+".!");
</SCRIPT>
In the page you can also add the name anywhere it is appropriate..
However, part of the real problem we have now it that there is less and
less privacy on the web, so why would you want to make that worse?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     To answer the question as asked (and leave off the brow-
beating)...  Internet-based JavaScript has no access which would allow 
that function -- for security reasons.  For business support in an 
intranet (or local) environment, there is more you can do if your 
business uses IE as its browser of choice.  But that is a question 
specific to JScript.   ;-)
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com