IE11 X-UA-Compatible 失效問題 (UserAgent string不會跟著改變)
問題:ASP.NET on Windows Server 2008 R2
原本在IE10以前,在HTML中使用X-UA-Compatible即可解決IE相容性問題,但到是IE11後,發現文件模式是會依X-UA-Compatible切換,但是使用者代理程式字串(UserAgent String)卻不會切換,造成很多相容性問題在IE11都無法解決,看了很多文章,上了很多hotfix、patch都沒用,最後修改 ie.browsers 檔後馬上就正常了!
修正方法:
1.修改 C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\Browsers\ie.browsers 及
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\Browsers\ie.browsers ,在這兩個檔案中最前面新增以下內容:
<!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko -->
<browser id="IE11Preview" parentID="Mozilla">
<identification>
<userAgent match="Trident/(?'layoutVersion'\d+).*rv:(?'revision'(?'major'\d+)(\.(?'minor'\d+)?))" />
<userAgent nonMatch="MSIE" />
</identification>
<capabilities>
<capability name="browser" value="IE" />
<capability name="layoutEngine" value="Trident" />
<capability name="layoutEngineVersion"value="${layoutVersion}" />
<capability name="isColor" value="true" />
<capability name="screenBitDepth" value="8" />
<capability name="ecmascriptversion" value="3.0" />
<capability name="jscriptversion" value="6.0" />
<capability name="javascript" value="true" />
<capability name="javascriptversion" value="1.5" />
<capability name="w3cdomversion" value="1.0" />
<capability name="ExchangeOmaSupported" value="true" />
<capability name="activexcontrols" value="true" />
<capability name="backgroundsounds" value="true" />
<capability name="cookies" value="true" />
<capability name="frames" value="true" />
<capability name="javaapplets" value="true" />
<capability name="supportsCallback" value="true" />
<capability name="supportsFileUpload" value="true" />
<capability name="supportsMultilineTextBoxDisplay" value="true" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
<capability name="supportsVCard" value="true" />
<capability name="supportsXmlHttp" value="true" />
<capability name="tables" value="true" />
<capability name="supportsAccessKeyAttribute" value="true" />
<capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
<capability name="vbscript" value="true" />
<capability name="revmajor" value="${major}" />
<capability name="revminor" value="${minor}" />
</capabilities>
</browser>
2.修改完畢後,執行以下兩行指令:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regbrowsers.exe -i
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regbrowsers.exe -i
3.再執行 iisreset 重新啟動 IIS,IE11就會正常依 X-UA-Compatible 調整 UserAgent String 了!
Reference: http://www.cnblogs.com/maoniu602/p/3799958.html
頁:
[1]