用javascript 获取客户端的域用户名

貌似仅限于ie,且有权限问题。

 

 
 
 
 
 
<script   language=javascript>   
  var   WshShell   =new   ActiveXObject("WScript.Shell");   
  alert("计算机名   =   "+   WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%"));   
  alert("登录用户名   =   "+   WshShell.ExpandEnvironmentStrings("%USERNAME%"));   
  </script>   
    
  <script   language=javascript>   
  var   wshNetwork   =   new   ActiveXObject("WScript.Network");   
  alert("域名               =   "+   wshNetwork.UserDomain);   
  alert("计算机名       =   "+   wshNetwork.ComputerName);   
  alert("登录用户名   =   "+   wshNetwork.UserName);   
  </script>


 

你可能感兴趣的:(用javascript 获取客户端的域用户名)