2016-11-17 51 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.