2

I have following javascript code to get currently logged in user:

<script language="javascript">
    function GetUserName()
    {
      var wshell = new ActiveXObject("WScript.Shell");
      alert(wshell.ExpandEnvironmentStrings("%USERNAME%"));
    }
</script>

But we need to configure some browser settings to use ActiveXObject. So is there any possibility to get current windows username without using ActiveXObject and WScript

Kevin M
  • 5,436
  • 4
  • 44
  • 46
  • 1
    I would be surprised if you find anything that doesn't require explicit user authorization. This is *not* something that's supposed to be immediately available to arbitrary websites. – user2357112 Jun 13 '14 at 09:16
  • I would be happy if I find any alternative method – Kevin M Jun 13 '14 at 09:20
  • Ask it with a prompt? Notice, that if this is not some intranet stuff, you really don't need any Windows usernames. If it is, you can ask IT staff to mark your page trusted, when it is allowed to use ActiveX without prompting/error. – Teemu Jun 13 '14 at 09:23
  • No.. it is not possible in my case..I have to find current username and send to server side... – Kevin M Jun 13 '14 at 09:25
  • Did you find a solution to this? – James Jun 17 '15 at 11:40
  • No, I didn't find any solution – Kevin M Jun 22 '15 at 07:26

0 Answers0