Airat Suleimanov
Airat Suleimanov

Reputation: 51

Get OS Win 7 username Javascript

Is it possible to get Windows username and PCName with Javascript in browsers IE, Chrome, Firefox, Opera?

Upvotes: 5

Views: 4476

Answers (2)

oezi
oezi

Reputation: 51817

i'd really wish this wouldn't be possible, but sadly it is (or was). i don't know for sure if this still works on Win7 and with current browser-versions, but in the past you could do this...

Internet Explorer

function getUsr() {
   var wshell = new ActiveXObject("WScript.Shell");
   return wshell.ExpandEnvironmentStrings("%USERNAME%");
}

Upvotes: 1

Mike Thomsen
Mike Thomsen

Reputation: 37526

No. That sort of information is not exposed to the javascript engine in the browser.

Upvotes: 6

Related Questions