如何强制 Iframe 在标准父框架下运行怪癖 [英] How to force Iframe to run quirks under a standard parent frame

查看:12
本文介绍了如何强制 Iframe 在标准父框架下运行怪癖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

We have a parent page that must run in IE9 standard mode, executing HTML5 commands. Underneath we have an iframe that must run in compatibility mode (IE7/8).

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

In IE9, as I understand, iframes inherits their doctype from parent. is that correct? Is there any solution for this issue? can , somehow, iframe be executed with quirks doctype under standard mode doctype parent frame? thanks, Tal

推荐答案

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

It's not possible to trigger a different rendering mode in a child iframe in IE9, as officially documented here: http://msdn.microsoft.com/en-us/library/gg558056(v=vs.85).aspx (emphasis added):

虽然较新的渲染引擎仅在 Windows Internet资源管理器检测到一个 HTML 页面请求了最高级别的支持标准,对于子页面并不总是如此可能会在 frame 和 iframe 元素中加载.因为只有一次可以激活一个渲染引擎,IE9 Mode 还包括Quirks 模式的模拟.

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 渲染引擎保持活动状态,但会以多种方式改变其行为以匹配旧的怪癖模式.

However, as it says, you can trigger "quirks mode emulation" which leaves the IE9 rendering engine active but alters its behavior in several ways to match the old quirks mode.

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

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

This example has a div with style background: #ff0000; background: 00ff00; border-radius: 30px ... in quirks mode, hex colors without # are accepted. In IE9 mode they are not. Loading the demo in IE9 will show a red div in the parent page, and a green div (but still with rounded corners) in the iframe.

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

How to trigger quirks mode emulation in an iframe: http://msdn.microsoft.com/en-us/library/gg558096(v=vs.85).aspx

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

Short version: omit DOCTYPE, add: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

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

Complete list of effects quirks mode emulation has on rendering: http://msdn.microsoft.com/en-us/library/gg558047(v=vs.85).aspx

这篇关于如何强制 Iframe 在标准父框架下运行怪癖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆