使用< object>标记以包含HTML内容:包含文件的允许格式 [英] Using <object> tag to include HTML content: allowed format of included file

查看:103
本文介绍了使用< object>标记以包含HTML内容:包含文件的允许格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我知道如何使用< object> 标签从单独的文件中包含HTML内容。我找不到任何有关的信息是在包含的HTML文件中允许/要求的内容。可以说包含文件仅仅是一些带有HTML标签的文本,还是必须是一个包含头文件< head> <身体GT; ?如果它出现在原始文档的DOM内,它是如何出现的呢?或者两份文件是完全分开处理的?



是的,我知道,我可以尝试看看哪些方法可行。但是,我对HTML有足够的了解,知道现在发生的事情可能不是正确的做事方式。我不希望任何人在这里列出所有的规则,但如果有人可以发布一些链接,我会非常感激。这是一个已经证明超越难以搜索互联网的话题。

13.5关于嵌入式文档的注意事项,我相信我已经找到了我的两个问题的答案。第二段说,


嵌入式文档完全独立于嵌入
的文档。例如,嵌入式
文档中的相对URI根据嵌入式文档的基本URI(
不是主文档的基本URI)进行解析。嵌入式文档只能在另一个文档(例如,在子窗口中)中呈现
;它仍然是
独立。

所以,是的,因为@Quentin和@Sinan都说,它需要嵌入.html文件是一个完整的,有效的.html文件。而且,不,它不会成为原始文档DOM的一部分。



感谢大家提供的及时协助。 StackOverflow社区继续令我惊叹。

OK, I know how to include HTML content from a separate file using the <object> tag. What I can't find any info about is what is allowed/required within the included HTML file. Can said included file merely be some text with some HTML tags, or does it have to be a complete HTML file with headers, <head>, and <body>? How does this appear within the DOM of the original document, if it appears within that DOM at all? Or are the two documents treated entirely separately?

Yes, I know, I could experiment to see what works. However, I know enough about HTML to know that what happens to work, for now, may not be the correct way to do things. I am not expecting anyone to list out all the rules here, but if someone could post some links I would much appreciate it. This is a topic that has proven exceeding difficult to search the internet for.

解决方案

In 13.5 Notes on embedded documents, I believe I have found the answer to both of my questions. The second paragraph says,

An embedded document is entirely independent of the document in which it is embedded. For instance, relative URIs within the embedded document resolve according to the base URI of the embedded document, not that of the main document. An embedded document is only rendered within another document (e.g., in a subwindow); it remains otherwise independent.

So, yes, as both @Quentin and @Sinan said, it would require the embedded .html file to be a complete, valid .html file. And, no, it would not become part of the DOM of the original document.

Thanks to everyone for their prompt assistance. The StackOverflow community continues to amaze me.

这篇关于使用&lt; object&gt;标记以包含HTML内容:包含文件的允许格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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