【发布时间】:2012-04-25 07:32:53
【问题描述】:
function checkActiveX() {
if (window.ActiveXObject){
try{
var username = new ActiveXObject("WScript.Network").UserName;
return true;
}
catch(e){
return false;
}
}
}
在 IE 中运行该方法时,通常会出现一个确认对话框:
An activex control on this page might be unsafe to interact with other parts of the page javascript. Do you want to allow this interaction?
但在某些计算机上,我只是收到一个 javascript 错误,没有提示:
automation server can't create object
如果我尝试生成一个新的 activex 对象,我只是再次收到错误,没有新的提示。有什么方法可以生成一个新的提示,以便用户可以接受 activex?或者他/她是否需要更改安全设置?在那种情况下,是哪一个?
非常感谢任何帮助。
【问题讨论】:
标签: javascript internet-explorer activex