I am trying this LINK if it is working. I try to debug it in JSFiddle
and JSBin
using Chrome v55
and IE v7
. I know that this is impossible Cuz I read some links before I make this thread. Is there any alternative way for this kind of problem on how to get the mac address of pc?.
<script type="text/javascript">
var macAddress = "";
var ipAddress = "";
var computerName = "";
var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}");
e = new Enumerator(wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True"));
for(; !e.atEnd(); e.moveNext()) {
var s = e.item();
macAddress = s.MACAddress;
ipAddress = s.IPAddress(0);
computerName = s.DNSHostName;
}
</script>
<input type="text" id="txtMACAdress" />
<input type="text" id="txtIPAdress" />
<input type="text" id="txtComputerName" />
<script type="text/javascript">
document.getElementById("txtMACAdress").value = unescape(macAddress);
document.getElementById("txtIPAdress").value = unescape(ipAddress);
document.getElementById("txtComputerName").value = unescape(computerName);
</script>