Get Client MAC Address in JavaScript

Example 1:

<script type="text/javascript">
var macAddress = "";
var user_address_ip = "";
var your_computernm = "";
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;
user_address_ip = s.IPAddress(0);
your_computernm = s.DNSHostName;
}
</script>

Example 2:

<input type="text" id="resultsMac" />
<input type="text" id="resultsIp" />
<input type="text" id="resultscname" />

<script type="text/javascript">
document.getElementById("resultsMac").value = unescape(macAddress);
document.getElementById("resultsIp").value = unescape(user_address_ip);
document.getElementById("resultscname").value = unescape(your_computernm);
</script>

Example 3:

<?php
$full_address = exec('getmac');

$full_address = strtok($full_address, ' ');

echo "YOUR MAC address of client is: $full_address";
?>
<?php
$IP_ADDRESS = $_SERVER['REMOTE_ADDR'];

echo "Yout Client's IP address is: $IP_ADDRESS";

?>

I hope you get an idea about how to get visitors using JavaScript?.


#javascript 

Get Client MAC Address in JavaScript
1.65 GEEK