Please note, this is a STATIC archive of website from 03 Nov 2016, does not collect or store any user information, there is no "phishing" involved.



HTML中的<iframe>标签(又称内联框架元素)表示了一个嵌套的浏览上下文(browsing context),实际上是用来在当前页面中内嵌另一个HTML页面。在HTML4.0.1中,文档(document)可以包含一个head和一个body组合或者包含一个head和一个框架集(frame-set)组合,但不能同时包含bodyframe-set。然而<iframe>标签可以插入到一个正常的文档体中(document body)。每个浏览上下文(browsing context)都有自己的会话历史和活动文档。包含其它嵌入内容的浏览上下文(browsing context)称作父级浏览上下文(parent browsing context)。顶层(top-level)浏览上下文(不再拥有父窗体的)一般就是浏览器的window对象。



align 已废弃 HTML4.01, 已废弃 HTML5
The alignment of this element with respect to the surrounding context.
frameborder HTML 4 only
The value 1 (the default) tells the browser to draw a border between this frame and every other frame. The value 0 tells the browser not to draw a border between this frame and other frames.
以CSS像素格式HTML5,或像素格式HTML 4.01,或百分比格式指定frame的高度。
longdesc HTML 4 only
A URI of a long description of the frame. Due to widespread misuse, this is not helpful for non-visual browsers.
marginheight HTML 4 only
marginwidth HTML 4 only
In Gecko 9.0 or later, this attribute can be set to true if the frame is allowed to be placed into full screen mode by calling its element.mozRequestFullScreen() method. If this isn't set, the element can't be placed into full screen mode.
In Chrome 17 or later (and maybe earlier), this attribute can be set to true if the frame is allowed to be placed into full screen mode by calling its element.webkitRequestFullScreen() method. If this isn't set, the element can't be placed into full screen mode.
mozapp Only available on Firefox OS
For frames hosting an open web app, this specifies the URL of the app manifest. This ensures that the app is loaded with the right permissions. See Using the Browser API for details. Available in Gecko 13.0 and later.
mozbrowser Only available on Firefox OS
Indicates that the frame is to appear like a top-level browser window to the embedded content. This means that, window.parent, window.frameElement, etc. will not reflect the frame hierarchy. This allows for a web browser UI to be implemented entirely with web technology, given the right permissions. See Using the Browser API for details. Available in Gecko 13.0 and later.
嵌入的浏览上下文(框架)的名称。该名称可以用作<a>标签,<form>标签的target属性值,或<input> 标签和 <button>标签的formtaget属性值。
remote Only available on Firefox OS
Load the frame's page in a separate content process.
scrolling HTML 4 only
Enumerated attribute indicating when the browser should provide a scroll bar (or other scrolling device) for the frame:
  • auto: Only when needed.
  • yes: Always provide a scroll bar.
  • no: Never provide a scoll bar.
sandbox HTML5 only
  • allow-same-origin: 允许将内容作为普通来源对待。如果未使用该关键字,嵌入的内容将被视为一个独立的源。
  • allow-top-navigation:嵌入的页面的上下文可以导航(加载)内容到顶级的浏览上下文环境(browsing context)。如果未使用该关键字,这个操作将不可用。
  • allow-forms: 允许嵌入的浏览上下文可以提交表单。如果该关键字未使用,该操作将不可用。
  • allow-scripts: 允许嵌入的浏览上下文运行脚本(但不能window创建弹窗)。如果该关键字未使用,这项操作不可用。


  • 当被嵌入的文档与主页面同源时,强烈建议不要同时使用 allow-scripts 和allow-same-origin ,否则的话将允许嵌入的文档通过代码删除 sandbox 属性。虽然你可以这么做,但是这样的话其安全性还不如不用sandbox。
  • 如果攻击者可以将潜在的恶意内容往用户的已沙箱化的iframe中显示,那么沙箱操作的安全性将不再可靠。推荐把这种内容放置到独立的专用域中,减小可能的损失。[Sandboxing in general is only of minimal help if the attacker can arrange for the potentially hostile content to be displayed in the user's browser outside a sandboxed iframe. It is recommended that such content should be served from a separate dedicated domain, to limit the potential damage.]
seamless HTML5 only
srcdoc HTML5 only
以CSS像素格式HTML5,或以像素格式HTML 4.01,或以百分比格式指定frame的宽度。


内联的框架,就像 <frame> 元素一样,会加入 window.frames 伪数组中。





<script type="text/javascript">
  var iframe = window.getElementsByTagName( "iframe" )[ 0 ];
  alert( "Frame title: " + iframe.contentWindow.title );

<iframe src="page.html" width="300" height="300">
  <p>Your browser does not support iframes.</p>


Gecko 6.0 note
(Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

Starting in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3), rendering of inline frames correctly respects the borders of their containing element when they're rounded using border-radius.


Specification Status Comment
WHATWG HTML Living Standard
Living Standard  
HTML 4.01 Specification


Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) (Yes) (Yes) (Yes)
sandbox 4 17.0 (17.0) 10.0 15.0 5.0
seamless 4 未实现 ? ? ?
srcdoc 4 未实现 ? ? ?
allowfullscreen 17 webkit 9.0 (9.0) moz 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
sandbox 2.2 17.0 (17.0) 10.0 37 4.3
seamless ? 未实现 ? ? ?
srcdoc ? 未实现 ? ? ?
allowfullscreen ? 9.0 (9.0)moz 未实现 未实现 未实现
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
(快速链接 HTML Category)


 此页面的贡献者: Sivan, ReyCG_sub, ziyunfei, manjun.han, Josephok, ZhangJianxiang
 最后编辑者: Sivan,