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

标签 javascript google-chrome internet-explorer-8 applet activexobject

以前我在做

    <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/

相关文章:

javascript - 如何更改IE8中TextNode的textContent?

函数内的 JavaScript 函数 - 返回一个对象

javascript - 为我的discord.js 机器人创建排名列表

google-chrome - 没有链接的 Typescript blob 文件名

java - 按键事件不适用于 selenium webdriver 中的 chrome 浏览器

javascript - 如何在同一域上的 IE8 中访问嵌套框架的 location.href ?

html - 显示 :before but hiding element with CSS only

javascript - 无法将图像附加到 div 元素,引发异常

javascript - console.log 在 Chrome 中退出工作

javascript - Google Transliterate API 无法在移动 Chrome 中运行