Force “Internet Explorer 8” browser mode in intran

2019-01-03 13:40发布

There are "Internet Explorer 8", "Internet Explorer 8 Compatibility Mode", and IE7 mode in IE8.

However, the default setting in IE make all intranet website use "IE8 Compatibility Mode" even I have setted doctype, the meta tag, http header as suggested to force it into IE8 mode.

I have

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

and

<meta http-equiv="X-UA-Compatible" content="IE=8" >

But it still goes into "IE8 Compatibility Mode", without any changes in IE setting.

How to force it into pure "IE8" mode, without change any browser's setting?

PS. I am not talking "document mode" here.

13条回答
beautiful°
2楼-- · 2019-01-03 13:52

Read somewhere that the DOCTYPE declaration must be the very first line. No comments of any kind, nor empty lines.

In combination with setting the HTTP Response Headers, this worked for me. Browser Mode went from "IE9 Compatibility Mode" to just "IE9 Mode".

查看更多
三岁会撩人
3楼-- · 2019-01-03 13:52

This combo did the trick for me:

<!DOCTYPE HTML>
<HEAD>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
</HEAD>

at least IE developer tools reports IE9 Compat View, IE8 standards

just for kicks i tried EmulateIE7 and that worked as well. simplifying the extended !DOCTYPE was key.

查看更多
Summer. ? 凉城
4楼-- · 2019-01-03 13:56

If you are using .NET, I have the answer for you:

HTML:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8" >

Web.Config:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=8" />
      </customHeaders>
    </httpProtocol>
查看更多
一纸荒年 Trace。
5楼-- · 2019-01-03 13:59

Set a custom HTTP header instead of using the <meta... in the <head> section. These are supposed to be equivalent, but I have seen that an X-UA-Compatible HTTP header from the server will override IE 8's "Display intranet sites in Compatibility View" setting, where the <meta... element would not.

查看更多
beautiful°
6楼-- · 2019-01-03 14:05

To override the Compatibility View settings for intranet or all websites you need to make IE8 emulate itself.

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
查看更多
可以哭但决不认输i
7楼-- · 2019-01-03 14:10

The answer marked as "correct" is technically correct but suggests that there is no solution to the real issue being faced by most people that is: "how do I properly show on IE8, with compatibility mode enabled, a web application which does not support compatibility mode?".

<!DOCTYPE HTML>
<HEAD>
    <meta http-equiv="X-UA-Compatible" content="Edge" >
</HEAD>

this worked for me on several workstations.

If the above code is implemented on application side, IE8 appears to behave as if it was not in compatibility mode, even though it will still show browser mode as compatibility mode.

查看更多
登录 后发表回答