我有一个网站 <noscript>
在除 IE (7,8,9,10) 以外的所有浏览器上都可以正常工作的标签。
在 Internet 选项中的安全设置下禁用脚本后,我只能在我的 PC 上使用 <noscript>
IE 上的内容,但在其他 PC(几乎所有)上我看不到代码。使用这些 PC,我们使用相同的设置访问 Gmail 和 FB 的网站,我们确实收到了没有启用 js 的警告。
这是 HTML:
<noscript>
<div class="noscript">
JavaScript must be enabled in order for you to use WEBSITE NAME in standard view.<br />
However, it seems JavaScript is either disabled or not supported by your browser.<br />
To use standard view, enable JavaScript by changing your browser options, then <a href="">try again</a>.
</div>
</noscript>
CSS:
.noscript {
background: red;
color: #fff;
padding: 10px;
text-align: center;
position: relative;
z-index: 3;
}
有什么想法吗?
谢谢!
最佳答案
我也遇到过这个问题。我在 IE 中工作,然后它突然停止了。我发现,如果您的 css 嵌套在实际 css 定义中的 noscript 标签下,它将不起作用。如果您只使用一个类名,那很好。
我正在使用 IE 10 进行测试,并使用他们的开发工具将文档模式更改为较旧的浏览器模式以进行验证。实际使用旧版浏览器时,结果可能会有所不同。如果是这种情况,请报告。
示例 html:
<noscript>
<div class="noscript">
JavaScript must be enabled ...
</div>
</noscript>
不起作用:
// classes nested beneath a noscript tag are not applied by IE
noscript div.noscript {
display: block;
text-align: center;
color: white;
font-weight: 700;
background: #D53333;
margin: 0 auto;
padding: 4px;
}
有效:
div.noscript {
display: block;
text-align: center;
color: white;
font-weight: 700;
background: #D53333;
margin: 0 auto;
padding: 4px;
}
关于javascript - noscript 标签在 Internet Explorer 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15761148/