以前我在做
<script>
function fun1(){
var sh=new ActiveXObject("Wscript.Shell");
sh.run("\\\\ntbot\\my.exe");
}
fun();
</script>
这段代码没有问题。它愉快地从 IE 在客户端计算机上执行 exe,从 chrome 运行相同的我编写的小程序,然后我运行 exe。所以我所做的代码更改是
<scipt>
function testCSS(prop) {
return prop in document.documentElement.style;
}
var isChrome = !!(window.chrome && chrome.webstore && chrome.webstore.install);
var isIE = /*@cc_on!@*/false || testCSS('msTransform');
function fun2(isIE,isChrome)
{
if(isIE){
var sh=new ActiveXObject("Wscript.Shell");
sh.Run("\\\\ntbot\\my.exe");
}if(isChrome){
appletsource="<APPLET archive='CalciApplet.jar' codebase='/kiss' CODE='AppletGchrome.CalculateApplet.class' WIDTH='0' HEIGHT='0'></APPLET>"
document.getElementById("appletplace").innerHTML=appletsource;
}
}
fun2(isIE,isChrome);
</script>
它不适用于 Chrome,但不适用于 IE 在 IE 中,我收到 Automation Server can't create object. 错误
请帮助我。谢谢。
问候, 斯普尼尔·P。
最佳答案
ActiveX 是 IE 仅限!它永远不会在 Chrome 上运行。
Automation Server 无法创建对象表示 ActiveX 的安全设置设置在错误的级别。将您的页面添加到受信任的站点。
关于javascript - 包含 chrome 条件后,自动化服务器无法在 IE8 中创建对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15112567/