Reputation: 51
Is it possible to get Windows username and PCName with Javascript in browsers IE, Chrome, Firefox, Opera?
Upvotes: 5
Views: 4476
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
Reputation: 37526
No. That sort of information is not exposed to the javascript engine in the browser.
Upvotes: 6