使用html5在html中包含html文件 [英] Include html file in html using html5

查看:177
本文介绍了使用html5在html中包含html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个HTML文件,假设 a.html b.html 。在 a.html 中我想包含 b.html

在JSF中,我可以这样做:

 < ui:include src =b.xhtml/> ; 

这意味着在 a.xhtml 文件中,我可以包含 b.xhtml



我们如何在 *中做到这一点。 html 文件?



使用html 5(如果它可以在html 5中完成)。
<令人惊讶的是,同样的问题被问及,这是可能的:解决方案

> HTML5包含文件



Rafa的回答:




使用对象标记:

 < object name =footype =text / htmldata =foo.inc>< /对象> 

foo.inc应包含有效的HTML。



< hr>

我在Konqueror,Firefox和Chromium上测试过它。注意你必须使用一个单独的< / object> 标签,否则在标签被丢弃后,任何内容都会被丢弃。 p>

如果你觉得它有用(我这样做),请注意Rafa答案(不是我的),因为这不可能正在像疾病一样蔓延。 b

I have 2 HTML files, suppose a.html and b.html. In a.html I want to include b.html.

In JSF I can do it like that:

<ui:include src="b.xhtml" />

It means that inside a.xhtml file, I can include b.xhtml.

How can we do it in *.html file?

using html 5 (if it can be done at all in html 5).

解决方案

Surprisingly, the same question was asked and it is possible: HTML5 include file

Rafa's answer:


Use the object tag:

<object name="foo" type="text/html" data="foo.inc"></object>

foo.inc should include valid HTML.


I tested it on Konqueror, Firefox and Chromium.

Note you must use a separate </object> tag otherwise any content after it gets discarded.

If you find it useful (I do), please upvote Rafa answer (not mine) because "it is not possible" is spreading like disease.

这篇关于使用html5在html中包含html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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