JavaScript - Code is not work in localhost server....ActiveXObject
Asked By Amit Dhorajiya on 09-May-13 01:43 AM
When i use this code in html file then i can get mac address of client's machine but when i use this code in php file and sun it in local wamp server it can't give me mac address of client's machine .............so what can i do please help me for getting client's mac address for my application security ...........please
<script language="javascript">
$(document).ready(function(){
var obj = new ActiveXObject("WbemScripting.SWbemLocator");
var s = obj.ConnectServer("Machine");
var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
var e = new Enumerator(properties);
while(!e.atEnd())
{
e.moveNext();
var p = e.item ();
if(!p) continue;
if(p.MACAddress != null)
{
//alert(p.MACAddress);
document.getElementById("hidMAC").value = p.MACAddress;
//alert(document.getElementById("hidMAC").value);
}
}
});
</script>
Robbe Morris replied to Amit Dhorajiya on 09-May-13 10:11 PM
You are not going to be able to use this component on other people's machine due to browser security constraints. They are going to have to give your site/page full trust authority and most of your visitors won't even know how. And, if it is on machines in corporate environments, they won't permit the user.
You are SOL...