views:

12

answers:

0

Hi , everybody,

I have found a code sample to get the mac address of a PC but my problem is that it only work when launched on the desktop (locally) but when I upload the HTML page on my server it doesn't work at all. is there a way to sign this script inside a cab or something else to make it work online? thank you to help me. I am stuck.

here is the code

function showMacAddress() { var obj = new ActiveXObject("WbemScripting.SWbemLocator"); var s = obj.ConnectServer("."); var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); var output; output=''; output=output + 'CaptionMACAddress'; while(!e.atEnd()) { e.moveNext(); var p = e.item (); if(!p) continue; output=output + ''; output=output + '' + p.Caption; + ''; output=output + '' + p.MACAddress + ''; output=output + ''; } output=output + ''; document.getElementById("box").innerHTML=output; }