我正在尝试将以下代码插入到我的所有页面中:
<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/