强制 IE9 进入 Quirks 模式?

发布于 2024-10-19 13:35:44 字数 494 浏览 7 评论 0原文

我有一个带有 iframe 的页面,并且 iframe 包含需要在怪异模式下运行的代码(它是 Microsoft 的 Outlook Web Access,因此无论如何它都不是我们可以修复的代码)。 IE9引入了一个“功能”,当父框架处于IE9文档模式时,它也会强制所有iframe进入相同的文档模式。这破坏了我们的 iframe 代码。

我希望这是 IE9 中的一个错误,但我的票被拒绝为“设计使然”(这里是票(如果您愿意看的话)

我无法以怪异模式运行整个网站,但我只需要它发生在此页面上。有没有办法以编程方式打开怪异模式渲染?或者是一种模拟按下“兼容性视图”按钮的方法 - 按下这个按钮几乎可以将 IE9 变成 IE8,效果也很好。

可以做这两件事吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

铁轨上的流浪者 2024-10-26 13:35:44

我遇到了同样的问题,并在 2011 年 4 月对其进行了相当广泛的研究。截至那时,在 IE9 中,在“标准模式”下拥有一个顶级文档,在“怪异模式”下在子 iframe 中拥有一个文档的唯一方法是使用元标记使浏览器的行为就像 IE8 一样。 (据我所知,情况仍然如此,微软无意改变它。)您可以使用多种元标记来更改浏览器模式,但我使用过的有效的一个是:

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

如果您包含此元标记,所有文档都应根据其文档类型正确呈现(根据 IE8 规则)。

但请注意,这会阻止您使用 IE9 中任何新支持的 css 功能,即使在顶级文档中也是如此。您将无法使用 border-radius、box-shadow、opacity 等。

iframe 会以怪异模式渲染吗?,它提出了有关 ie 中的 iframe 和 doctype 的更一般性问题。

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.

不打扰别人 2024-10-26 13:35:44

顺便说一句,嵌入在 iframe 中的内容的怪异模式与普通怪异模式并不完全相同。请参阅:http://msdn.microsoft.com /en-us/library/gg558056(v=VS.85).aspx

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

甜扑 2024-10-26 13:35:44

您应该能够在 IFrame 和主机之间拥有不同的兼容模式 - 请参阅: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

您可以使用 X-UA-Compatible 标记明确指定您想要的兼容模式,甚至比使用按钮更能指定:http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx

HTH。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文