将text / html嵌入对象(而不是iframe) [英] Embedding text/html in an Object (instead of an iframe)

查看:203
本文介绍了将text / html嵌入对象(而不是iframe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<iframe data="/localfile.html" type="text/html" width="200" height="200"></iframe>
<iframe data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></iframe>
<object data="/localfile.html" type="text/html" width="200" height="200"></object>
<object data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></object>

在IE以外的每个浏览器下,所有4个测试都可以正常工作。在IE 6和7下,最后一个失败并显示一个空框。
有一个解决方法允许IE在对象中加载外部html。

Under every browser except IE, all 4 of these tests work. Under IE 6 and 7, the last one fails and shows an empty frame. Is there a workaround that allows IE to load the external html in an object?

推荐答案

有关如何在IE中使用Object的信息: http: //aplus.rs/web-dev/insert-html-page-into-another-html-page/

Review the following for more information about how to use Object with IE: http://aplus.rs/web-dev/insert-html-page-into-another-html-page/

这可以归结为什么IE期望与其他浏览器。对于IE,您必须使用classid属性而不是type属性。例如(来自上面引用的站点):

It boils down to a difference in what IE expects versus other browsers. For IE, you have to use the classid attribute instead of the type attribute. For example (from the above referenced site):

<!--[if IE]>
<object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="some.html">
    <p>backup content</p>
</object>
<![endif]-->

<!--[if !IE]> <-->
<object type="text/html" data="some.html">
    <p>backup content</p>
</object>
<!--> <![endif]-->

请注意,classid特定于您尝试服务的内容类型。

Note that the classid is specific to the content type that you are trying to server.

这篇关于将text / html嵌入对象(而不是iframe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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