Does IE9 use doucument mode IE9 Standards or Quirks?

Trying to set up the styling on a new Shopping Cart, and having trouble with Internet Explorer (IE)

When I view it in IE, I click on F12 to activate the code viewer (like FireBug) and it lets me choose to view it using the browser IE9 or earlier. So far, so good…

But right next to the browser selector is the “Document Mode” selector and sometimes it says “Quirks Mode” and sometimes it says “IE9 Standards” (when using IE9 browser) - and parts of the page styling goes crazy when I switch back and forth from Quirks to Standards.

Help!

  • Which does IE9 and IE8 actually use?
    – Does it have to work for both?
    — Is there a way to force it to one or the other?

Any guidance or tips is appreciated. Thanks,

Greg

Hi,

First thing to note is that IE does not replicate earlier versions very well at all. It misses many of the bugs, quirks and behaviours so is extremely unreliable as a sure fire test for an earlier version. Indeed I rarely see it accurately render any earlier version apart from the simplest layouts.

IE9 and IE8 will be in standards mode if you are using the correct doctype (and you haven’t triggered the compatibility button by mistake).

Quirks mode is triggered by having no doctype, or partial doctype (or in older versions by having something above the doctype) or when recovering from a script error when it triggers quirks mode in an attempt to recover (ie9+ if I remember correctly). When the compatibility button is pressed IE also goes into some weird hybrid mode that behaves like no other version of IE! It’s best to avoid compatibility mode altogether and use the ‘edge’ meta tag to force the issue.

So to answer your question: If the page is using a current valid doctype then IE8 and IE9 will be in standards mode (unless you have pressed the compatibility button). There is no need to test in quirks mode.

Hi Paul,

I do have some access the to head of the shopping cart pages. Can you reply back with the code used to “set the correct doctype” for IE8 and IE9 ?

Then I will paste it in and see if that fixes the problem.

Thank you!

Greg

Hi,

Depending on whether you are using html, pseudo xhtml or html5 then any of these doctypes will trigger standards mode.

html4.1:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

xhtml 1.0


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

html5:


<!DOCTYPE HTML>

They need to be the first line on the page with nothing else above them (even comments).

You may also want to put the meta tag in the head to stop compatibility mode.


<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

For IE8 the tag must be the first tag in the head section (<head>).


<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">