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

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

问题描述

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



在IE9中,据我所知,iframe从parent继承它们的doctype。那是对的吗?
这个问题是否有解决方案?可以,不知何故,在标准模式doctype父框架下执行iframe的怪癖doctype?
谢谢,
Tal

解决方案

不可能在子iframe中触发不同的呈现模式IE9,正如这里正式记录: http:// msdn 。$ microsoft.com / en-us / library / gg558056(v = vs.85).aspx (强调增加):


虽然只有当Windows Internet
Explorer检测到HTML页面请求最高级别的
支持标准时,才会使用较新的呈现引擎,但对于子页面
,情况并非总是如此可能会加载框架和iframe元素。 因为只有
一个渲染引擎可以一次处于活动状态
,所以IE9模式还包括用于Quirks模式的
模拟。


然而,正如它所说的那样,您可以触发怪异模式模拟,这会离开IE9渲染引擎积极但通过几种方式改变其行为以匹配旧的怪癖模式。

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



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



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

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



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


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).

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

解决方案

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):

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.

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 demo: http://jsbin.com/ozejuk/1/

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.

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

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

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天全站免登陆