DOCTYPE,iFrame,HTML5-一起 [英] DOCTYPE, iFrames, HTML5 - together

查看:112
本文介绍了DOCTYPE,iFrame,HTML5-一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了需要在页面中嵌入iFrame的情况. iFrame使用HTML 5 DOCTYPE(和相关元素),并且我在各种浏览器(IE风格,mozilla等)中都能正常运行.但是,承载iFrame的主页具有不同的DOCTYPE(<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">).

I've got a situation where an iFrame needs to be embedded in a page. The iFrame uses the HTML 5 DOCTYPE (and associated elements) and I have it working correctly in the various browsers (IE flavors, mozilla, etc.). However, the main page that hosts the iFrame has a different DOCTYPE (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">).

当我在IE9中查看结果页面并使用开发工具"时,我看到浏览器模式"设置为IE9,而文档模式"设置为IE7标准.如果我将文档模式"更改为怪癖"以外的其他内容,则看起来不错.

When I view the resulting page in IE9 and use the "Dev Tools" I see that Browser Mode is set to IE9 and Document Mode gets set to IE7 standards. If I change the Document Mode to something besides Quirks, it looks fine.

推荐答案

可悲的是,您无法使iframe在其他模式下运行.一种可能的解决方案是在HTML5中使用XHTML样式的语法,该语法是有效的HTML5,并且将由较早的呈现引擎识别.

You can't make your iframe run in a different mode, sadly. One potential solution is to use XHTML-style syntax in your HTML5, which is valid HTML5 and will be recognised by the older rendering engine.

这篇关于DOCTYPE,iFrame,HTML5-一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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