IE 8兼容: X-UA-Compatible的解釋

以下爲轉載資料:


對於IE8及以上版本,例如:

   1: <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" /> 

強制瀏覽器按照特定的版本標準進行渲染。但不支持IE7及以下版本。如果用分號(;)分隔,對於不同的瀏覽器版本就有不同的兼容性,例如

   1: <meta http-equiv="X-UA-Compatible" content="IE=7; IE=9" />

以上就表明,將IE8和IE7按照IE7標準渲染,但是IE9還是按照IE9的標準渲染。它允許有不同的向後兼容水平。儘管在真實情況中,你只要選擇一種版本:

   1: <meta http-equiv="X-UA-Compatible" content="IE=8" />

 

 
這對於測試和維護會更加簡單。而通常更加有用的方式就是進行仿真模擬
   1: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

對於IE=EDGE

   1: <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> 

這意味着,會強制瀏覽器按照最新的標準去渲染。就像在Google’s CDN使用最新版本的JQuery一樣,這是按照最新版本,但也可能由於沒有固定的版本而破壞你的佈局。

最後,考慮下面這個

   1: <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

添加”chrome=1“將允許站點在使用了谷歌瀏覽器內嵌框架(Chrome Frame)的客戶端渲染,對於沒有使用的,則沒有任何影響。

For more information, there is plenty to read here, and if you want to learn about ChromeFrame (which I recommend) you can learn about its implementation here.

PS:X-UA-Compatible是針對 IE8 版本的一個特殊文件頭標記,用於爲 IE8 指定不同的頁面渲染模式,對於ie8之外的瀏覽器是不識別的。

目前絕大多數網站都用<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ >來作爲IE8的兼容方法。爲了避免製作出的頁面在IE8下面出現錯誤,建議直接將IE8使用IE7進行渲染。也就是直接在頁面的header的meta標籤中加入如下代碼:

<meta http-equiv=”X-UA-Compatible” content=”IE=7″ />

<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ >

<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE8″ >

但是<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ >仍然是首選。

StackOverFlow原鏈接;http://stackoverflow.com/questions/14611264/x-ua-compatible-content-ie-9-ie-8-ie-7-ie-edge?answertab=active#tab-top

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章