眾所周知,微軟的Internet Explorer團隊一直在致力於將IE8打造為最符合業內標准的瀏覽器,所不幸的是,當前並非所有的網站都認同這些標准。如果你擔心你的網站在IE8的標准模式下不能正常工作的話,下面這些方法也許對你有所幫助:
1. 你可以將你網站中所有的頁面都加上下面這行meta標記頭。
<
meta
http-equiv
="X-UA-Compatible"
content
="IE=EmulateIE7"
/>
該標記可以讓你網站的頁面在IE8的兼容模式下運行,而無論用戶是否設置了瀏覽器的兼容模式。對於一個網站中的頁面來說,這也許是一個不錯的解決方案!
2. 配置IIS,添加HTTP Header
該方法可以在不修改網站源代碼的基礎上非常便捷地實現網站在IE8中的兼容模式訪問。當然,你也可以通過修改網站的config配置文件來實現這一點:
<?
xml version="1.0" encoding="utf-8"
?>
< configuration >
< system.webServer >
< httpProtocol >
< customHeaders >
< add name ="X-UA-Compatible" value ="IE=EmulateIE7" >
</ customHeaders >
</ httpProtocol >
</ system.webServer >
</ configuration >
< configuration >
< system.webServer >
< httpProtocol >
< customHeaders >
< add name ="X-UA-Compatible" value ="IE=EmulateIE7" >
</ customHeaders >
</ httpProtocol >
</ system.webServer >
</ configuration >
3. 如果你的網站運行在Apache環境下,下面這篇文章詳細介紹了如何進行配置。
有關更多IE8兼容模式的信息可以訪問微軟的官方網站:
http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx
<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=EmulateIE9" />