javascript获取目标机MAC 有时候会得到空或是undefined 是什么原因造成的呢?应该怎么解决?
<objectid="locator"classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6"viewastext></o...
<object id="locator" classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6" viewastext> </object>
<object id="foo" classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></object>
<script type="text/jscript" event="OnObjectReady(objObject,objAsyncContext)" for="foo" >
if(objObject.IPEnabled !=null &&objObject.IPEnabled !="undefined"&&objObject.IPEnabled==true)
{
if(objObject.MACAddress!= null&&objObject.MACAddress!="undefined")
MACAddr = objObject.MACAddress;
}
</script>
<script type="text/jscript">
var service = locator.ConnectServer();
var MACAddr ;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</script>
<script type="text/jscript" event="OnCompleted(hResult,pErrorObject,pAsyncContext)" for="foo" >
var macAddress=unescape(MACAddr);
// alert(macAddress);
$("#HFmac").val(macAddress);
</script> 展开
<object id="foo" classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"></object>
<script type="text/jscript" event="OnObjectReady(objObject,objAsyncContext)" for="foo" >
if(objObject.IPEnabled !=null &&objObject.IPEnabled !="undefined"&&objObject.IPEnabled==true)
{
if(objObject.MACAddress!= null&&objObject.MACAddress!="undefined")
MACAddr = objObject.MACAddress;
}
</script>
<script type="text/jscript">
var service = locator.ConnectServer();
var MACAddr ;
service.Security_.ImpersonationLevel=3;
service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration');
</script>
<script type="text/jscript" event="OnCompleted(hResult,pErrorObject,pAsyncContext)" for="foo" >
var macAddress=unescape(MACAddr);
// alert(macAddress);
$("#HFmac").val(macAddress);
</script> 展开
展开全部
是浏览器安全设置的比较高,或者提示使用不安全的activex控件时,选择了否导致控件没起作用。
追问
浏览器的安全级别我已经调了 如果太高的话就直接屏蔽了,现在就是有时能获取到,有时获取不到...
追答
那还是具体设置问题,查看安全的具体设置,是否有选择提示,或者有一些直接被禁用
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询