What Throws Internet Explorer into Quirks Mode

IE renders my page in Quirks mode

The point you mentioned in the question about the doctype needing to be the first thing in the page applies to the page as it is seen by the browser.

The content of the PHP code is entirely irrelevant, if it doesn't generate any output.

However, if the PHP is generating output -- even if that output is nothing more than a blank line -- then it will be making the doctype invalid.

So the first thing you should do is open the page in your browser, and select the 'view source' option. look at the actual HTML that the browser receives. If there's anything before the doctype, then it needs to be moved or removed.

Once you've done that, the second thing to do is run your page through the W3C Validator. This will tell you about any other HTML errors you might have on your page. You have at least one, as the <meta> tag needs to be inside the <head> tag, but there may be other errors too. It is possible for some HTML errors to throw the browser into quirks mode, so you should fix anything that is reported by the validator (although the doctype issue is by far the most common cause).

Hop that helps.

When does IE8 go into Quirks mode?

The doctype tag has to be first in the markup, otherwise it's ignored. If you have an XML declaration tag before the doctype tag, IE will ignore the doctype.

If the HTML markup is utterly broken, the browser might fall back into interpreting it as tag soup instead of as an HTML document, and rendering it in Quirks mode.

Use the W3C HTML validator to check that the code doesn't have any serious errors.

IE8 and quirks mode

Running a few quick tests that can be found here seem to indicate that blank lines shouldn't throw IE8 into Quirks Mode (which is different to Compatability Mode that everyone seems to be confusing it with).

I wrote a breakdown on how incredibly confusing the different modes of IE8/7 here and I didn't even include Quirks Mode in the breakdown. A detailed description of Quirks mode can be found here (not for the original question, but others might find it interesting.)

Dreamweaver causing Quirks Mode in Internet Explorer

Ok, I figured this out.

Because of the extensive IE-compliance tweaking I'm doing, I was using conditional comments. However, I was using them on the html tag. There's nothing wrong with this in principle but Dreamweaver won't handle your live template updates properly when you do this (It will place the Dreamweaver-specific template lock code first before the doctype, thereby ensuring that your pages will throw Quirks mode in IE).

So what I did was move my conditional comment system away from the html tag, instead using them immediately after your opening body tag and immediately before your closing body tag like so:

<body>
<!--[if IE 6 ]> <div id="ie" class="ie6"> <![endif]-->
<!--[if IE 7 ]> <div id="ie" class="ie7"> <![endif]-->
<!--[if IE 8 ]> <div id="ie" class="ie8"> <![endif]-->
<!--[if gt IE 8 ]> <div id="ie"> <![endif]-->
<!--[if !IE]><div id="not-ie"> <![endif]-->

{YOUR HTML CODE}

</div>
</body>

This way, Dreamweaver places the doctype and html tag before the template lock code, and your resulting pages will appear in standards mode on IE (all things being normal).

Cheers.

Force IE9 into Quirks mode?

I had your same issue and researched it fairly extensively back in April 2011. As of then, the only way to have a top-level document in "standards mode" and a document in a child iframe in "quirks mode" in IE9 was to use a meta tag to have the browser behave as if it were IE8. (As far as I know, this is still the case and Microsoft has no intention to change it.) There are a variety of meta tags you can use to change browser mode, but the one I have used that has worked was:

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

If you include this meta tag, all of the documents should be properly rendered (per IE8 rules) according to their doctype.

Note, however, that this precludes you from using any of the newly supported css features in IE9, even in the top-level document. You won't be able to use border-radius, box-shadow, opacity, etc..

There's some more info on this at Will an iframe render in quirks mode?, which asks a more general question about iframes and doctypes in ie.

Unable to write to script element using JavaScript in IE 5 quirks mode

The issue was resolved by setting the text property instead of the innerText property.



Related Topics



Leave a reply



Submit