javascript 自动化服务器在包含 chrome 条件后无法在 IE8 中创建对象

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15112567/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 23:32:32  来源:igfitidea点击:

Automation Server can't create object in IE8 after including condition for chrome

javascriptgoogle-chromeinternet-explorer-8appletactivexobject

提问by swapy

Previously i was doing

以前我在做

    <script>
    function fun1(){
       var sh=new ActiveXObject("Wscript.Shell");
       sh.run("\\ntbot\my.exe");
    }
    fun();
    </script>

there is no problem with this code. it happily execute exe on client machine from IE, to run same from chrome i written applet, and from that i am runing exe. so code changes i done are

这段代码没有问题。它很高兴地从 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>

not its working on Chrome, but not in IE in IE i am getting Automation Server can't create object.error

不是它在 Chrome 上的工作,但不是在 IE 中的 IE 我得到自动化服务器无法创建对象。错误

plz help me in this.. thank you.

请在这方面帮助我..谢谢。

Regards, swapnil P.

问候,swapnil P.

回答by epascarello

ActiveX is IE Only!It will never work on Chrome.

ActiveX 仅支持 IE 它永远不会在 Chrome 上工作。

Automation Server can't create objectmeans the security settings for activeX are set at the wrong level. Add your page to trusted sites.

自动化服务器无法创建对象意味着 activeX 的安全设置设置在错误的级别。将您的页面添加到受信任的站点。