Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force IE9 into Quirks mode?

I have a page with an iframe, and the iframe contains code that needs to run in quirks mode (it's Microsoft's Outlook Web Access, so it's not our code that we could fix anyway). IE9 introduced a "feature" that when the parent frame is in IE9 document mode, it also forces any iframes into the same document mode. This breaks the code we have an the iframe.

I was hoping this was a bug in IE9, but my ticket was turned down as "by design" (here is the ticket if you care to look)

I can't run the entire site in quirks mode, but I need it to happen only on this page. Is there a way to programmatically turn on quirks mode rendering? Either that, or a way to emulate pressing the "compatibility view" button - pressing this pretty much turns IE9 into IE8, which works just fine as well.

Is it possible to do either of these things?

like image 766
FiniteLooper Avatar asked Feb 25 '11 22:02

FiniteLooper


People also ask

What's the difference between standards mode and quirks mode?

In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This is essential in order to support websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications.

How do I change document mode to ie9 standards?

Procedure. In your Internet Explorer web browser, press F12 to open the Developer Tools window. Click Browser Mode and select the version of your web browser. Click Document Mode, and select the Internet Explorer standards for your Internet Explorer release.


1 Answers

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.

like image 150
mikepr Avatar answered Oct 01 '22 15:10

mikepr