繁体   English   中英

条件注释在ie11中不起作用

[英]Conditional comments not working in ie11

我试图使用条件注释在其他浏览器上在ie11上加载webcomponents聚合物polyfill和在其他浏览器上加载webcomponente-lite polyfill,所以我有:

<head>
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bower_components/roboto-condensed/css/roboto-condensed.css">
<!--[if IE]>
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
<![endif]-->
<!--[if !IE]><!-->
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<!--<![endif]-->

问题是,始终会加载webcomponents-lite.min.js,这是IE11中的事件

有什么建议吗?

IE 11不支持条件注释。

不再支持条件注释

影响适用于Internet Explorer 10及更高版本。 影响IE10标准模式和更高版本,包括可互操作的怪癖模式。 Internet Explorer 10标准和怪异模式中已删除了对条件注释的支持,以提高互操作性和与HTML5的兼容性。 这意味着条件注释现在像其他浏览器一样被视为常规注释。 此更改可能会影响专门为Windows Internet Explorer编写的页面或使用浏览器嗅探来更改其在Internet Explorer中行为的页面。

您需要尝试另一种专门针对IE11的方法。

搜索SO使我得到了这个答案,该答案使用特征检测来确定是否加载Polymer的polyfills。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM