加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

在对象(而不是iframe)中嵌入text / html

发布时间:2020-12-14 16:38:03 所属栏目:资源 来源:网络整理
导读:iframe data="/localfile.html" type="text/html" width="200" height="200"/iframeiframe data="http://example.com/remotefile.html" type="text/html" width="200" height="200"/iframeobject data="/localfile.html" type="text/html" width="200" heigh
<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?

解决方法

有关如何在IE: http://aplus.rs/web-dev/insert-html-page-into-another-html-page/中使用Object的更多信息,请查看以下内容

归结为IE与其他浏览器相比的差异.对于IE,您必须使用classid属性而不是type属性.例如(来自上面引用的网站):

<!--[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特定于您尝试服务的内容类型.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读