js获取客户端mac地址的方法
1 function getmac() { 2 var locator = new ActiveXObject("WbemScripting.SWbemLocator"); 3 var service = locator.ConnectServer("."); 4 var properties = service.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=True"); 5 var e = new Enumerator(properties); 6 { 7 var p = e.item(); 8 var mac = p.MACAddress; 9 return mac; 10 } 11 }
注意:只适用于IE浏览器,并且要将地址添加ie的可信任站点,设置兼容模式,将IE设置中的所有ActiveX权限全部启用