X-UA-Compatible” content=”IE=7″ 的意思

來源:互聯網
上載者:User

from: http://liupeng.us/Browers-Meta-Tag-X-UA-Compatible-ie8/

 

X-UA-Compatible是針對ie8新加的一個設定,對於ie8之外的瀏覽器是不識別的,這個區別與content="IE=7"在無論頁面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的標準模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。對於多數網站來說,它是首選的相容模式。

目前IE8尚在測試版中,所以為了避免製作出的頁面在IE8下面出現錯誤,建議直接將IE8使用IE7進行渲染。也就是直接在頁面的header的meta標籤中加入如下代碼:

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

這樣我們才能使得頁面在IE8裡面表現正常!

 

 

Browers Meta Tag X-UA-Compatible

開啟瀏覽器查看liupeng.us的頁面原始碼,細心的朋友會發現meta資訊裡面多了個tag標籤

 
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml"> 
  3. <head> 
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  5. <meta http-equiv="Content-Language" content="utf-8" /> 
  6. <meta http-equiv="x-ua-compatible" content="IE=7" /> 
  7. <meta http-equiv="Pragma" content="no-cache" /> 
  8. <meta content="關注WEB標準,使用者體驗,關注前端技術,網頁設計師" name="keywords" /> 
  9. <meta content="關注WEB標準,使用者體驗,關注前端技術,網頁設計師" name="description" /> 
  10. <meta content="SaBlog" name="copyright" /> 

裡面多了一句

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

X-UA-Compatible 是什嗎?

看看MSDN上的資料說明:

 

主要意思我總結一下:

X-UA-Compatible是針對ie8新加的一個設定,對於ie8之外的瀏覽器是不識別的,這個區別與content="IE=7"在無論頁面是否包含<!DOCTYPE>指令,都像是使用了 Windows Internet Explorer 7的標準模式。而content="IE=EmulateIE7"模式遵循<!DOCTYPE>指令。對於多數網站來說,它是首選的相容模式。

目前IE8尚在測試版中,所以為了避免製作出的頁面在IE8下面出現錯誤,建議直接將IE8使用IE7進行渲染。也就是直接在頁面的header的meta標籤中加入如下代碼:

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

這樣我們才能使得頁面在IE8裡面表現正常!

 

參考資料:Introducing IE=EmulateIE7

 

在還有就是在iis中加入:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="X-UA-Compatible" value="IE=EmulateIE7">
      </customHeaders>
    < tpProtocol>
  </system.webServer>
</configuration>
描述符

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.