3

I want to get the OS username with JavaScript for cross browser. I had been trying the different solutions for this but none actually worked. I don't actually want to install 3rd party plugin as according to my requirement I can't do that.

This is so far I get on the web while surfing for the solution

    var wshshell = new ActiveXObject("wscript.shell");
    var username = wshshell.ExpandEnvironmentStrings("%username%");
    alert(username);
Sagar V
  • 12,158
  • 7
  • 41
  • 68
Faisal Javaid
  • 39
  • 1
  • 2

1 Answers1

0

Sorry, this is impossible. Webpages cannot access the OS (Operating System) because this would be an issue for security.

The code you found only works in IE and when the user sets your page to the lowest security level (you cannot rely on this).

not my real name
  • 393
  • 4
  • 16