- Published on
What is the `X-UA-Compatible` HTTP Header?
- Authors
- Name
- hwahyeon
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
- Compatibility Maintenance: Forces IE to render the page in a specific compatibility mode.
- Enforcing Modern Standards: Ensures consistent user experience by enforcing the latest rendering engine.
Usage
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.
HTML Meta Tag Setting:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
- Note: HTTP response headers always take precedence over HTML
<meta>
tags.
- Note: HTTP response headers always take precedence over HTML
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
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.
- HTTP response headers have a higher priority than HTML
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.
- The
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.
- Official support for IE ended on June 15, 2022. However, the
Recommendation for
IE=edge
:- To enforce the latest standards mode,
IE=edge
is recommended. Avoid forcing specific compatibility modes (e.g.,IE=7
orIE=8
), as they can expose security vulnerabilities.
- To enforce the latest standards mode,
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.
- The