以编程方式检测IE中是否启用了Active Scripting?

时间:2017-10-03 16:22:43

标签: javascript jquery internet-explorer settings

在IE中手动启用Active Scripting:

  

"以下内容应在Internet Explorer中启用脚本:

     

1.在“工具”菜单上,单击“Internet选项”,然后单击“安全”选项卡。

     

2.单击Internet区域。

     

3.单击“自定义级别”。

     

4.在“安全设置 - Internet区域”对话框中,单击“脚本”部分中的“为活动脚本启用”。"

有没有办法以编程方式检测是否使用javascript启用了这个?

1 个答案:

答案 0 :(得分:0)

在IE / Chrome中玩游戏看起来像是在尝试使用ActiveX时抛出一个有用的异常

try{
     var excelApp = new ActiveXObject("Excel.Application")
     /* working continue */
}catch(e){
    if(e.message === "ActiveXObject is not defined"){
        //unsuported browser
    }else if(e.message === "Automation Server Can't Create Object"){
        /* security settings not setup correctly
           enable Active scripting and add site to trusted list */
    }
}

求解"Automation Server Can't Create Object"

我同意那些帖子中给出的情绪回答:

  

就个人而言,我会像瘟疫那样避免使用ActiveX,因为它是锁定的   你进入IE唯一的世界。因此,为什么我们仍然有人坚持   IE6。

相关问题