javascript - 当页面包含 JavaScript 时如何避免 IE 消息栏?

标签 javascript html css internet-explorer activex

我正在尝试将以下代码插入到我的所有页面中:

<script language="javascript">
    if (top.location == self.location)
    {
        top.location = '../index.html'
    }
</script>

当我有这个页面并尝试从 IE 8 运行该页面时,我的页面顶部显示了一个黄色条,要求我允许插件。

没有其他浏览器(firefox/opera/chrome/safari)这样做。

每次访问页面时都要点击这个很烦人。如何禁用它?

我只是希望我不必使用:

<!--[if !IE]>-->
<script language="javascript">
    if (top.location == self.location)
    {
        top.location = '../index.html'
    }
</script>
<!--<![endif]-->

最佳答案

我认为您是在谈论 javascript 的本地执行,因此请参阅有关网络标记 (MOTW) 的讨论中的答案:ActiveX Content in a local web page, and "the mark of the web"

另见 MSDN reference了解更多信息:

关于javascript - 当页面包含 JavaScript 时如何避免 IE 消息栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9512709/

相关文章:

html - 标题和正文之间的不明空间

确认脚本中的 Javascript IIF

javascript - 什么是 Angular 中的 createEmbeddedView() 上下文参数

javascript - Bookshelfjs + bcrypt hashPassword 可以创建但不能更新

html - 表格不会溢出

jquery - 在多个类的单个实例上切换动画

javascript - 为什么我的指令不显示我传递给它的字符串

html - 将两个 HTML 文档嵌入到一个页面中

html - 在垂直线上垂直居中书写文本

html - 如何使用电子邮件处理媒体查询/非内联样式。