Force IE9 into Quirks mode?
P

3

19

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?

Pragmatic answered 25/2, 2011 at 22:17 Comment(0)
P
10

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.

Pokelogan answered 4/1, 2012 at 19:4 Comment(2)
Yep, this is the solution we ended up using. It's a bit crappy, but it does work.Pragmatic
Reviving a very old thread, but this meta tag goes in the head of the top level doc, right? I have a similar situation where I have no control of what is rendered inside of the quirk-y iFrame but full control on the top level document. Thanks!Schlep
T
5

BTW, the quirks mode for content embedded in an iframe is not exactly the same as normal quirks mode. See this: http://msdn.microsoft.com/en-us/library/gg558056(v=VS.85).aspx

Tole answered 25/3, 2011 at 2:27 Comment(0)
T
-2

You should be able to have differing compat modes between the IFrame and the host - see: http://blogs.msdn.com/b/cjacks/archive/2010/12/01/does-a-standards-web-page-inside-of-an-iframe-in-a-quirks-web-page-render-in-standards-or-quirks.aspx

You can specify the compat mode you want explicity, even more than you can with the button, using the X-UA-Compatible tag: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx

HTH.

Torpedoman answered 26/2, 2011 at 4:43 Comment(1)
That's the point. I should be able to, but they've changed this in IE9. Now it forces the compat mode of the parent page to any child iframes.Pragmatic

© 2022 - 2024 — McMap. All rights reserved.