2016-11-17 78 views
0

我试图使用条件注释上加载IE11和ohter浏览器webcomponente - 精简版填充工具webcomponents聚合物填充工具,所以我必须:条件注释不IE11工作

<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中的事件

任何建议?

回答

0

IE 11 does not support conditional comments.

条件注释不再支持

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

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

Searching around SO brought me to this answer, which uses feature detection to determine whether or not to load Polymer's polyfills.