Override intranet compatibility mode IE8

后端 未结 19 2061
执念已碎
执念已碎 2020-11-22 10:04

By default IE8 forces intranet websites into compatibility mode. I tried changing the meta header to IE8, but it doesn\'t acknowledge the meta header and just uses the brows

19条回答
  •  情深已故
    2020-11-22 10:14

    This question is a duplicate of Force "Internet Explorer 8" browser mode in intranet.

    The responses there indicate that it's not possible to disable the compatibility view (on the server side) - https://stackoverflow.com/a/4130343/24267. That certainly seems to be the case, as none of the suggestions I've tried have worked. In IE8 the "Browser Mode" gets set to Internet Explorer 8 Compatibility view no matter what kind of X-UA-Compatible header you send.

    I had to do some special handling for IE7 and compatibility mode, which caused the browser to render using IE8 but report it was IE7, broke my code. This is how I fixed my code (I am aware this is a horrible hack and I should be testing for features not browser versions):

    isIE8 = navigator.appVersion.indexOf("MSIE") != -1 && parseFloat(navigator.appVersion.split("MSIE")[1]) == 8;
    if (!isIE8 && navigator.appVersion.indexOf("MSIE") != -1 && parseFloat(navigator.appVersion.split("MSIE")[1]) == 7 && navigator.appVersion.indexOf("Trident") != -1) {
        // Liar, this is IE8 in compatibility mode.
        isIE8 = true;
    }
    

提交回复
热议问题