除了可以使用「web.config」及「頁面」本身設定以外,後端的設定方式是…
「頁面」的基礎宣告優先權較高於「web.config」
「頁面」設定
1
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
「web.config」設定
1
2
3
4
5
6<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=EmulateIE7" />
</customHeaders>
</httpProtocol>「Code behind」設定
1
2
3
4
5
6protected void Page_Load(object sender, EventArgs e) {
HtmlMeta myHtmlMeta = new HtmlMeta();
myHtmlMeta.HttpEquiv = "X-UA-Compatible";
myHtmlMeta.Content = "IE=EmulateIE8";
Header.Controls.AddAt(0, myHtmlMeta);
}