What is the function of the X-UA-Compatible meta tag within HTML


Viewed 21,527 times


Could you tell me the function of this meta tag within an HTML document?

 <meta http-equiv="X-UA-Compatible" content="ie=edge">

1 answer


This goal is unique to Internet Explorer (entered in IE8), it can configure the page to be rendered as in another version of Internet Explorer.

Note that if you are using IE9 or 10 for example with doctype to HTML5:

<!DOCTYPE html>

Internet Explorer does not support doctype for HTML5, so it will probably end up going into a mode called Quirks Mode.

Quirks mode makes the site look like an older version of IE, which can cause your site to fail, so when using X-UA-Compatible with the value IE=edge it will force the browser to render with the latest.

There are several values beyond the IE=edge

  • IE=5 which is practically the Quirks Mode
  • IE=7 which renders as IE7
  • IE=8 which renders as IE8
  • IE=9 which renders as IE9
  • IE=10 which renders as IE10
  • IE=11 which renders as IE11
  • IE=edge renders with the highest mode supported by the browser, for example if you use IE10 it will force render as IE10
  • IE=EmulateIE7 if the defined doctype is validated/recognized it renders as IE7, otherwise render as Quirks Mode
  • IE=EmulateIE8 if the defined doctype is validated/recognized it renders as IE8, otherwise render as Quirks Mode
  • IE=EmulateIE9 if the defined doctype is validated/recognized it renders as IE9, otherwise render as Quirks Mode
  • IE=EmulateIE10 if the defined doctype is validated/recognized it renders as IE10, otherwise render as Quirks Mode
  • IE=EmulateIE11 if the defined doctype is validated/recognized it renders as IE11, otherwise render as Quirks Mode

And remember, if you don’t define the X-UA-Compatible and use doctype for HTML5 Internet Explorer will work as Quirks Mode


Since IE11 this metatag is considered obsolete, but it is not necessary to remove it, it will not affect the behavior in browsers that no longer use it

What are DOCTYPE?

The DOCTYPE which means Document TYPE (document type) and is a statement that should go at the beginning of the document without there being any kind of space before (it may even work in some browsers with spaces before, but in general there should be no spacing), it defines the document type and is not only used by HTML, some XML types like SVG also use it, but as we are talking about HTML I will just cite the examples that have been most used and known.

Note: if the page has no doctype, being for HTML4 or 5 it will render as Quirks mode or Standard Mode (a type of Quirks mode from the Firefox browser and other browsers that use the Gecko engine)

Until a few years ago we used HTML4.01, it doesn’t mean that because today we have 5, that it doesn’t work, it 4.01 is fully functional and there’s no problem in using, the myths of the internet will say that HTML5 is better for Google, but that’s just myth, Google ROBOT is very smart and interprets pages by a number of factors, but I won’t go into detail.

Talking about HTML4.01, it had 4 types of DOCTYPE that aimed to improve rendering for the type of need:


It is used to force the document to be the most correct/strict, forcing the page to avoid multiple attributes and tags, which was much less permissive, but this was actually a great advantage, if you can create a site that is worth 100% (or close to it) with it, then you could be sure that your site at least in the matter of HTML would be well rendered in several browsers, of course everything may have an exception, but still this was the purpose, I personally must say that this is my favorite doctype to date


DTD HTML Transitional

Perhaps it was the most common perhaps of HTML4.01, it includes both the structural elements with the presentation elements, it was more permissive to help maintain compatibility between browsers and versions

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

DTD HTML Frameset

It is used when working with frames (not iframes), where the tag will be required <frame> (and <frameset>):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

Frames were a set of pages that were loaded each into their frame, an example taken from https://www.w3.org/TR/html401/present/frames.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
<TITLE>Exemplo de Iframe</TITLE>
<FRAMESET cols="20%, 80%">
  <FRAMESET rows="100, 200">
      <FRAME src="contents_of_frame1.html">
      <FRAME src="contents_of_frame2.gif">
  <FRAME src="contents_of_frame3.html">
      Seu navegador não suporta frames


In addition to HTML4.01 there was XHTML1.0, XHTML supported HTML and Xml merging, Htmls are could have tags flaws (which today is still a bit common occurs by web developers' failure) and tags such as <br> and <input> should always have />, thus:

<input type="text" name="exemplo" value="" />
<br />

Xhtml1.0 had the same Doctypes as HTML4.01, however they changed somewhat:

  • DTD XHTML Strict

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  • DTD XHTML Transitional

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  • DTD XHTML Frameset

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"

The line breaking is actually optional, I believe that people did it just to facilitate the "readability" of the code


With the arrival of HTML5 we have a unique doctype, the <!DOCTYPE html>, we no longer have to differentiate between HTML and XHTML, ie started to accept tags that end like this <img src=""> or so <img src="" />, has also supported the inclusion of any tag, it being a valid tag or not and XML tag (which usually tags are customized by those who created XML), an example of Xml is SVG (vector image):

<!DOCTYPE html>

    <p>Olá mundo!</p>
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        <rect x="10" y="10" height="100" width="100" style="stroke:#ff0000; fill: #0000ff"/>

However it is not because modern browsers began to implement HTML5 which means that older browsers like the much used one at the time IE8, 9 and 10 would support this doctype alone, so the solution found was to use the X-UA-Compatible, of course, does not mean that HTML5 tags would work, this only prevented the browser from going to IE=5 mode (Quirks mode), so that IE supports tags like <section>, <footer> and <nav> some extra things were needed that were a combination of Javascript with CSS, a basic example would be this:

section, footer, nav {
   display: block;
var tags = [ "section", "footer", "nav" ];
for (var i = 0, j = tags.length; i < j; i++) {

Believe the document.createElement made the browser to recognize the tags and so it was possible to apply the CSS, of course with the time came more reliable techniques such as html5shiv, that was created by a developer, just add on your page like this:

<!--[if lt IE 9]>
    <script src="html5shiv.js"></script>

As there are still some IE users, so many sites still make use of html5shiv

  • 1

    Thank you so much for your help

  • 3

    +1 I could not explain better

  • 3

    @Andersoncarloswoss thank you, I am very happy even more coming from a person I admire. Believe it or not there was still something I could add as the question of height=100% automatic and the question of px Optional in transitional, HTML4 was a time of xD suffering

  • 1

    When the answer turns into a class.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.