我试图理解 window
、document
和 iframe
的分层图片。
因此,window
只是浏览器的窗口,document
是 DOM 所在的位置。 文档
加载到窗口
。
创建 iframe
是否很像创建对话框 (window.openDialog()
)(只不过是一个窗口)?
两者都有内容文档和父窗口。
最佳答案
以下是来自 HTML5 的创始人 WHATWG 的精彩讨论: 6 Loading Web pages -- HTML: The Living Standard - Edition for Web Developers
总而言之,实际页面上还有更多内容:
A browsing context is an environment in which Document objects are presented to the user.
A tab or window in a Web browser typically contains a browsing context, as does an iframe.
和
Certain elements (for example, iframe elements) can instantiate further browsing contexts. These are called nested browsing contexts.
而且,如果您想了解更多关于 WHATWG 的信息: FAQ - WHATWG Wiki
关于javascript - iframe 相当于窗口吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17686418/