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
  • 36,828
  • 10
  • 60
  • 83
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
  • 51,017
  • 10
  • 98
  • 115