gpt4 book ai didi

html - 如何强制 Iframe 在标准父框架下运行怪异

转载 作者:行者123 更新时间:2023-11-28 08:14:18 28 4
gpt4 key购买 nike

我们有一个父页面必须在 IE9 标准模式下运行,执行 HTML5 命令。下面我们有一个必须在兼容模式(IE7/8)下运行的 iframe。

据我了解,在 IE9 中,iframe 从父级继承其文档类型。那是对的吗?这个问题有什么解决办法吗?不知何故,iframe 可以在标准模式 doctype 父框架下使用怪异 doctype 执行吗?谢谢,塔尔

最佳答案

不可能在 IE9 的子 iframe 中触发不同的渲染模式,官方文档如下:http://msdn.microsoft.com/en-us/library/gg558056(v=vs.85).aspx (强调):

Although the newer rendering engine is only used when Windows Internet Explorer detects that an HTML page has requested the highest level of support for standards, the same is not always true for child pages that might be loaded within frame and iframe elements. Because only one rendering engine can be active at a time, IE9 Mode also includes emulation for Quirks Mode.

但是,正如它所说,您可以触发“怪癖模式模拟”,这会使 IE9 渲染引擎保持事件状态,但会以多种方式改变其行为以匹配旧的怪癖模式。

JSBin 演示:http://jsbin.com/ozejuk/1/

此示例有一个样式为 background: #ff0000; background: 00ff00; border-radius: 30px 的 div ...在怪异模式下,十六进制颜色没有 #被接受。在 IE9 模式下则不是。在 IE9 中加载演示将在父页面中显示一个红色 div,在 iframe 中显示一个绿色 div(但仍然带有圆角)。

如何在 iframe 中触发怪异模式模拟:http://msdn.microsoft.com/en-us/library/gg558096(v=vs.85).aspx

简短版本:省略DOCTYPE,添加:<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

怪异模式模拟对渲染的影响的完整列表:http://msdn.microsoft.com/en-us/library/gg558047(v=vs.85).aspx

关于html - 如何强制 Iframe 在标准父框架下运行怪异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23800399/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com