解決各種IE相容問題,IE6,IE7,IE8,IE9,IE10,ie8ie9

來源:互聯網
上載者:User

解決各種IE相容問題,IE6,IE7,IE8,IE9,IE10,ie8ie9
x-ua-compatible 標頭標籤大小寫不敏感,必須用在 head 中,必須在除 title 外的其他 meta 之前使用。
1、使用一行代碼來指定瀏覽器使用特定的文檔模式。
<meta http-equiv="x-ua-compatible" content="IE=9" >
<meta http-equiv="x-ua-compatible" content="IE=8" >
<meta http-equiv="x-ua-compatible" content="IE=7" >
 
2、在一些情況下,我們需要限定瀏覽器對文檔的解析到某一特定版本,或者將瀏覽器限定到一些舊版本的表現中。可以用如下的方式:
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE9" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" >
 
使用這種寫法,瀏覽器或者使用標準模式進行解析,或者使用 IE5 Quirks 模式進行解析。
 
3、為了測試,我們也可以使用下面的語句指定瀏覽器按照最高的標準模式解析頁面。
<meta http-equiv="x-ua-compatible" content="IE=edge" >
 
4、多個模式的指定。我們可以用逗號分割多個版本,這種情況下,瀏覽器會從這個列表中選擇一個他所支援的最高版本來使用標準模式進行渲染。如下面的例子,在IE8進行瀏覽時,將會使用IE7的標準模式進行渲染,因為他本身不支援IE9和IE10。
<meta http-equiv="x-ua-compatible" content="IE=7,9,10" >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.