5

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

2 Answers2

6

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

Mike Thomsen
  • 35,490
  • 10
  • 55
  • 80
1

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%");
}
oezi
  • 49,639
  • 10
  • 95
  • 114