How to fix Document mode restart in IE 9

31,358

One solution that should always work is to put your X-UA-Compatible in HTTP headers. Also, your <!DOCTYPE> should be specified at the top of your HTML document (<!DOCTYPE html> is the easiest one).

If you put your X-UA-Compatible declaration inside the meta tag you can run into the following problems:

  1. X-UA-Compatible is ignored unless it's present inside the first 4k of you page. If you put it somewhere in the bottom of your head section (or in the body) move it to top. The best place for it is right after encoding and language declarations.
  2. X-UA-Compatible is ignored if it's put inside IE conditional comments. For example:

    <!--[if IE]>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <![endif]-->
    

    In this case you should remove conditional comments.

  3. Also, you shouldn't have any text before the doctype declaration. If you've got any HTML comments there, for example, the IE will switch to quirks mode.

  4. Finally, check if you're viewing this site from the intranet. By default Compatibility View is enabled for Intranet sites.

I suggest set X-UA-Compatible header for you page and then see if your site is still switching to quirks mode. In that case you should check your markup and try to fix any HTML validator errors until it's back to Standards Mode.

Share:
31,358

Related videos on Youtube

Amin Mousavi
Author by

Amin Mousavi

Quality is not an act, it is a habit.

Updated on December 13, 2020

Comments

  • Amin Mousavi
    Amin Mousavi over 3 years

    I have a problem with opening my website in IE9. When I try to open my site I get this error in dev tools:

    HTML1113: Document mode restart from Quirks to IE9 Standards
    

    I googled and found an answer that suggested to use this:

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

    or

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

    ...but these do not work and I get the following message this time:

    HTML1115: X-UA-Compatible META tag ('IE=Edge') ignored because document mode is already finalized.
    

    What is my problem? I read several articles like IE’s Compatibility Features for Site Developers by Microsoft and traced my site with Determining IE9’s Document Mode flowchart and use all suggestions relating to !doctype on these sites but no-one could solve my problem and my IE engine reset after the page opened.

    I develop my site with ASP.NET 4 on Windows Server 2008. How can I fix this issue?

    • Blender
      Blender almost 12 years
      Without your website it's useless to speculate. Please link to your website and edit in the HTML of your page (excluding the <body>).
    • Amin Mousavi
      Amin Mousavi almost 12 years
      I have upload it for test here. Use username: "[email protected]" and password:"123456" to sign in and check this error. Thanks.
  • saurshaz
    saurshaz over 10 years
    Thank for the link. Cheers! Made my day
  • Tomasz Struczyński
    Tomasz Struczyński about 10 years
    Adding this to headers saved my day.. IE throws this also on every redirect, like 302. There's no HTML there, so it thinks it's quirks mode, duh. So STUPID...
  • Davide Vosti
    Davide Vosti about 10 years
    In my case I was missing <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="w3.org/1999/xhtml" > at the beginning of the page. I just had <html>
  • Chad von Nau
    Chad von Nau over 9 years
    RE: #2, It's possible to put x-ua-compatibile inside conditionals with a little hack målform.no/blog/x-ua-optimal. Without the hack, x-ua-compatible won't work inside a conditional, as you said, and it also won't work if there are conditionals before it målform.no/blog/…. RE: #3, Conditional comments are OK before the doctype målform.no/blog/no-condition-comments. These aren't my articles, but my testing supports them.
  • HddnTHA
    HddnTHA over 8 years
    @Andrew Андрей Листочкин i have no idea why i cant put any comments before <!DOCTYPE html> but when i changed the position of my html comment, it worked like charm. Thanks for solution.