Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving Windows user in JavaScript - Chrome/Firefox browsers

 
Venkataprasath Padmanabhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to retrieve logged in windows user name from a javascript,the following piece of code works only in IE, but my app has to work in Chrome, Firefox and Safari as well. Any help would be appreciated.

<html>
<head>
<script language="javascript">
function GetUserName()
{
var wshell = new ActiveXObject("WScript.Shell");
alert(wshell.ExpandEnvironmentStrings("%USERNAME%"));
}
</script>
</head>
<body OnLoad="GetUserName();">
</body>
</html>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ActiveX will only ever work with IE so you are out of luck.
 
Venkataprasath Padmanabhan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I was chasing a wild goose, I found a framework WAFFLE http://waffle.codeplex.com/ which nicely integrates with Spring Security to retrieve windows user and domain details on the server side which would fit exactly my requirement...

Thanks to WAFFLE...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic