以下js代码(实测有效),提醒只对ie内核有效
window.onload = show;
function show() {
var mac = getMac();
for(var i in array){
alert(array[i]);
}
}
function getMac() {
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var service = locator.ConnectServer(".");
var properties = service.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled =True");
var e = new Enumerator(properties);
{
var p = e.item();
var mac = p.MACAddress;
var ipv4 = p.IPAddress(0);
var ipv6 = p.IPAddress(1);
var array = {mac,ipv4,ipv6};
return array;
}
}