Early Access

Meta Tags

X-UA-Compatible

Learn how to use the X-UA-Compatible meta tag to improve your site.

Advises the web browser to display the webpage in compatibility view or a specific version of Internet Explorer. Primarily used to instruct Internet Explorer to use its Edge rendering engine.

Code Examples

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Instructs Internet Explorer to use the latest available rendering engine, ensuring more modern, standards-compliant HTML & CSS features are used.
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Forces Internet Explorer to use the IE8 rendering engine. This can cause compatibility issues on newer versions of the browser.
<meta http-equiv="X-UA-Compatible" content="" />
Leaving the content attribute of the X-UA-Compatible tag empty or not using the tag can result in the use of older rendering engines in IE.

Recommendations

  • Prefer Modern Web Standards
    Use this tag sparingly. Modern websites should be designed using modern web standards, ensuring they work across all browsers without needing such a directive.
  • Avoid Version-specific Rendering
    Specifying a version-specific rendering mode can lead to unpredictable results in different versions of IE or other browsers. Aim for a responsive, version-agnostic design.

Related Documentation

Related Meta Tags

refresh

http-equiv

Used to redirect the user to a new URL after a certain number of seconds, or to refresh the current page. While it can be useful for redirecting users or refreshing content, its usage is generally discouraged in favor of server-side redirects or JavaScript for a better user experience and performance.

<meta http-equiv="refresh" content="5;url=http://example.com">
Redirects the user to "http://example.com" after 5 seconds, giving a brief moment to read any important information before the redirect.

X-UA-Compatible

http-equiv

Advises the web browser to display the webpage in compatibility view or a specific version of Internet Explorer. Primarily used to instruct Internet Explorer to use its Edge rendering engine.

<meta http-equiv="X-UA-Compatible" content="IE=edge">
Instructs Internet Explorer to use the latest available rendering engine, ensuring more modern, standards-compliant HTML & CSS features are used.

content-type

http-equiv

Defines the MIME type and character encoding for the HTML document. It sets the character set used for the HTML document, which is crucial for correctly displaying text.

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
This example specifies the HTML document type with UTF-8 character encoding, ensuring correct text display and maximum compatibility.

Defines which dynamic resources are allowed to load, thus helping to prevent cross-site scripting attacks, data injection, and other malicious attempts to exploit web page vulnerabilities.

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://apis.google.com;">
Allows scripts, styles, and images to load from the site's own origin and scripts from Google APIs, tightening security by restricting external resources.

default-style

http-equiv

Specifies the name of the preferred stylesheet to use on a web page. This allows users or user agents to choose the default stylesheet amongst many provided.

<meta http-equiv="default-style" content="Main Style">
Correct use case where "Main Style" is precisely the title of one of the page’s alternative stylesheets.