Published on

What is the `X-UA-Compatible` HTTP Header?

Authors
  • avatar
    Name
    hwahyeon
    Twitter

The X-UA-Compatible HTTP header is used in Internet Explorer (IE) and older versions of Microsoft Edge (EdgeHTML-based) to specify the rendering mode of a web page. It is primarily employed to maintain compatibility with older browsers or to enforce the use of the latest standards mode.

Purpose

  1. Compatibility Maintenance: Forces IE to render the page in a specific compatibility mode.
  2. Enforcing Modern Standards: Ensures consistent user experience by enforcing the latest rendering engine.

Usage

  1. HTTP Header Setting:

    X-UA-Compatible: IE=edge
    
    • IE=edge: Uses the latest rendering engine (standards mode).
    • IE=7, IE=8: Forces compatibility mode for IE7 or IE8.
  2. HTML Meta Tag Setting:

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    
    • Note: HTTP response headers always take precedence over HTML <meta> tags.

Examples

Apache Configuration

<IfModule mod_headers.c>
    Header set X-UA-Compatible "IE=edge"
</IfModule>

Nginx Configuration

add_header X-UA-Compatible "IE=edge";

Key Points

  1. Priority of HTML Meta Tags vs. HTTP Headers:

    • HTTP response headers have a higher priority than HTML <meta> tags. It is recommended to configure this header on the server whenever possible.
  2. Unsupported in Modern Browsers:

    • The X-UA-Compatible header only works in Internet Explorer and EdgeHTML-based versions of Microsoft Edge. It is not supported in modern Chromium-based browsers like Chrome, the latest Microsoft Edge, or Firefox.
  3. Internet Explorer Support Ended:

    • Official support for IE ended on June 15, 2022. However, the X-UA-Compatible header can still be used in IE Mode of Microsoft Edge, which is supported until 2029.
  4. Recommendation for IE=edge:

    • To enforce the latest standards mode, IE=edge is recommended. Avoid forcing specific compatibility modes (e.g., IE=7 or IE=8), as they can expose security vulnerabilities.
  5. Discouraged in Modern Web Development:

    • The X-UA-Compatible header is unnecessary in modern browsers. Modern web development should avoid using this header and instead adhere to web standards.