简体   繁体   English

当包含页面处于怪癖模式时,iframe 不会在 ie9 模式下呈现

[英]iframe not rendering in ie9 mode when containing page is in quirks mode

I have an iframe in a page that runs in quirks mode (I don't have control over the containing page), and I need my page to render in a mode that is compatible with modern browser features.我在以 quirks 模式运行的页面中有一个 iframe(我无法控制包含页面),我需要我的页面以与现代浏览器功能兼容的模式呈现。

The contained page makes heavy use of newer JavaScript features (especially the nice array functions), and SVG rendering.包含的页面大量使用较新的 JavaScript 功能(尤其是漂亮的数组函数)和 SVG 渲染。 While I can shim the array functions easily enough, I can't force the svg to render.虽然我可以很容易地填充数组函数,但我无法强制渲染 svg。

To be clear, the inner page is NOT running in quirks mode - I have specified a doctype and the ie=edge < meta > tag.需要明确的是,内页没有在 quirks 模式下运行 - 我已经指定了一个 doctype 和 ie=edge < meta > 标签。 It looks like it's using the ie8 rendering mode (hard to be certain) 看起来它是在使用 ie8 渲染模式 (很难确定)

A sample of the issue is here: http://stevesspace.com/quirks/quirks.html - load it up in chrome to see the expected output, and check it in IE9 or 10 for the actual output.问题示例如下: http : //stevesspace.com/quirks/quirks.html - 在 chrome 中加载它以查看预期输出,并在 IE9 或 10 中检查实际输出。

EDIT: I've added the document mode and compatibility mode to the sample, I can confirm it's using IE8 doc mode.编辑:我已经在示例中添加了文档模式和兼容模式,我可以确认它使用的是 IE8 文档模式。

I ended up using an object tag instead of an iframe, it seems to work ok across modern browsers.我最终使用了对象标签而不是 iframe,它似乎在现代浏览器中工作正常。

<object type="text/html" data="http://example.com"></object>

It turns out you can't modify the URL using javascript in IE9, but that's not a big deal - removing/adding a new object element works just as well for this.事实证明,您无法在 IE9 中使用 javascript 修改 URL,但这没什么大不了的 - 删除/添加新的对象元素同样适用于此。

Update: This tag can also be in an intermediate page that the iframe points to and it all works fine Update 2: This solution does not work in IE10更新:此标签也可以位于 iframe 指向的中间页面中,并且一切正常更新 2:此解决方案在 IE10 中不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM