I have a code in my HTML to discover the user name using :
var objUserInfo = new ActiveXObject("WScript.network");
var uname = objUserInfo.UserName;
Unfortunately, this code only works in IE. Whats the equivalent code in JS ? I want to run this on Chrome or other non-IE browser. I have not so good alternative (cos vbs will be deprecated in html.. right ?) such as writing VBS but dont know how to call this via HTML :
Dim strCmd
strCmd = "cmd /q /c ""quser console | find /i ""console"" "" "
Dim buffer
buffer = WScript.CreateObject("WScript.Shell").Exec(strCmd).StdOut.ReadAll()
Dim c, consoleUserName
c = InStr(buffer,"console")
If c > 2 Then
consoleUserName = Trim(Mid(buffer,2,c-2))
Else
consoleUserName = ""
End If
WScript.Echo consoleUserName
Another alternative is i put an IE-Tab extension on Chrome so that it can run . Works, but it doesn't look aesthetically good. :)
Do you know any other possible ways ? My Web Server is IIS
Thanks