我在网站的 HEAD
部分中有以下样式表:
<!--[if !IE]-->
<link rel="stylesheet" href="theStyles/defaultStyle.css" type="text/css" charset="utf-8" />
<!--[endif]-->
<!--[if IE]>
<link rel="stylesheet" href="theStyles/defaultStyle_ie.css" type="text/css" charset="utf-8" />
<![endif]-->
我正在运行 IE 版本 10,但出于某种原因它正在读取非 IE 样式表。知道如何解决吗?我必须具体说明 IE 条件吗?
我看开发者工具,只加载了NON IE版本...
最终使用了这个:
<script type="text/javascript">
if (window.clipboardData)
alert("You are using IE!");
else
alert("NON IE");
</script>
最佳答案
根据 Microsoft :
As of Internet Explorer 10, conditional comments are no longer supported by standards mode. Use feature detection to provide effective fallback strategies for website features that aren't supported by the browser.
Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5. This means that Conditional Comments are now treated as regular comments, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.
关于html - 为什么 IE 特定样式表被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21681685/