The HTML element represents a nested browsing context, embedding another HTML page into the current one.
Each embedded browsing context has its own document and allows URL navigations. The navigations of each embedded browsing context are linearized into the session history of the topmost browsing context. The browsing context that embeds the others is called the parent browsing context. The topmost browsing context — the one with no parent — is usually the browser window, represented by the Window
object.
Warning: Because each browsing context is a complete document environment, every in a page requires increased memory and other computing resources. While theoretically you can use as many ``s as you like, check for performance problems.
This element includes the global attributes.
Specifies a Permissions Policy for the . The policy defines what features are available to the
[for example, access to the microphone, camera, battery, web-share, etc.] based on the origin of the request.
Note: A Permissions Policy specified by the allow
attribute implements a further restriction on top of the policy specified in the
0 header. It doesn't replace it.
Set to
2 if the can activate fullscreen mode by calling the
4 method.
Note: This attribute is considered a legacy attribute and redefined as
5.
Deprecated Non-standard
Set to
2 if a cross-origin should be allowed to invoke the Payment Request API.
Note: This attribute is considered a legacy attribute and redefined as
9.
Experimental Non-standard
Set to
2 to make the credentialless, meaning that its content will be loaded in a new, ephemeral context. It doesn't have access to the network, cookies, and storage data associated with its origin. It uses a new context local to the top-level document lifetime. In return, the ``3 [COEP] embedding rules can be lifted, so documents with COEP set can embed third-party documents that do not. See IFrame credentialless for more details.
Experimental
A Content Security Policy enforced for the embedded resource. See ``5 for details.
The height of the frame in CSS pixels. Default is ``7.
Indicates when the browser should load the iframe:
Load the iframe immediately on page load [this is the default value].
Defer loading of the iframe until it reaches a calculated distance from the visual viewport, as defined by the browser. The intent is to avoid using the network and storage bandwidth required to fetch the frame until the browser is reasonably certain that it will be needed. This improves the performance and cost in most typical use cases, in particular by reducing initial page load times.
Note: Loading is only deferred when JavaScript is enabled. This is an anti-tracking measure.
A targetable name for the embedded browsing context. This can be used in the Window`2 attribute of the `Window`3, `Window`4, or `Window`5 elements; the `Window`6 attribute of the `Window`7 or `Window`8 elements; or the `Window`9 parameter in the
`0 method.
Indicates which referrer to send when fetching the frame's resource:
The ``3 header will not be sent.
The ``3 header will not be sent to origins without TLS [HTTPS].
The sent referrer will be limited to the origin of the referring page: its scheme, host, and port.
The referrer sent to other origins will be limited to the scheme, the host, and the port. Navigations on the same origin will still include the path.
A referrer will be sent for same origin, but cross-origin requests will contain no referrer information.
Only send the origin of the document as the referrer when the protocol security level stays the same [HTTPS→HTTPS], but don't send it to a less secure destination [HTTPS→HTTP].
[default]
Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same [HTTPS→HTTPS], and send no header to a less secure destination [HTTPS→HTTP].
The referrer will include the origin and the path [but not the fragment, password, or username]. This value is unsafe, because it leaks origins and paths from TLS-protected resources to insecure origins.
Controls the restrictions applied to the content embedded in the . The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions:
Allows downloading files through an Window`3 or
`6 element with the attribute, as well as through the navigation that leads to a download of a file. This works regardless of whether the user clicked on the link, or JS code initiated it without user interaction.
Experimental
Allows for downloads to occur without a gesture from the user.
Allows the page to submit forms. If this keyword is not used, form will be displayed as normal, but submitting it will not trigger input validation, sending data to a web server or closing a dialog.
Allows the page to open modal windows by `allow`0, `allow`1, `allow`2 and `allow`3, while opening a `allow`4 is allowed regardless of this keyword. It also allows the page to receive `allow`5 event.
Lets the resource lock the screen orientation.
Allows the page to use the Pointer Lock API.
Allows popups [like from allow`8, `allow`9,
`0]. If this keyword is not used, that functionality will silently fail.
Allows a sandboxed document to open a new browsing context without forcing the sandboxing flags upon it. This will allow, for example, a third-party advertisement to be safely sandboxed without forcing the same restrictions upon the page the ad links to. If this flag is not included, a redirected page, popup window, or new tab will be subject to the same sandbox restrictions as the originating .
Allows embedders to have control over whether an iframe can start a presentation session.
If this token is not used, the resource is treated as being from a special origin that always fails the same-origin policy [potentially preventing access to and some JavaScript APIs].
Allows the page to run scripts [but not create pop-up windows]. If this keyword is not used, this operation is not allowed.
Experimental
Allows a document loaded in the to use the Storage Access API to request access to unpartitioned cookies.
Lets the resource navigate the top-level browsing context [the one named ``9].
Lets the resource navigate the top-level browsing context, but only if initiated by a user gesture.
Allows navigations to non-`2 protocols built into browser or registered by a website. This feature is also activated by
3 or
`8 keyword.
Note:
- When the embedded document has the same origin as the embedding page, it is strongly discouraged to use both
`5 and
4, as that lets the embedded document remove the
2 attribute — making it no more secure than not using the
`2 attribute at all. - Sandboxing is useless if the attacker can display content outside a sandboxed ``9 — such as if the viewer opens the frame in a new tab. Such content should be also served from a separate origin to limit potential damage.
Note: When redirecting the user, opening a popup window, or opening a new tab from an embedded page within an with the
`2 attribute, the new browsing context is subject to the same
2 restrictions. This can create issues — for example, if a page embedded within an
` without a `allow`4 or `allow`5 attribute set on it opens a new site in a separate tab, form submission in that new browsing context will silently fail.
The URL of the page to embed. Use a value of allow`7 to embed an empty page that conforms to the . Also note that programmatically removing an
`'s src attribute [e.g. via `allow`9] causes `allow`7 to be loaded in the frame in Firefox [from version 65], Chromium-based browsers, and Safari/iOS.
Inline HTML to embed, overriding the `allow`6 attribute. If a browser does not support the
01 attribute, it will fall back to the URL in the `allow`6 attribute.
The width of the frame in CSS pixels. Default is
06.
These attributes are deprecated and may no longer be supported by all user agents. You should not use them in new content, and try to remove them from existing content.
Deprecated
The alignment of this element with respect to the surrounding context.
Deprecated
The value
09 [the default] draws a border around this frame. The value
10 removes the border around this frame, but you should instead use the CSS property
11 to control borders.
Deprecated
A URL of a long description of the frame's content. Due to widespread misuse, this is not helpful for non-visual browsers.
Deprecated
The amount of space in pixels between the frame's content and its top and bottom borders.
Deprecated
The amount of space in pixels between the frame's content and its left and right borders.
Deprecated
Indicates when the browser should provide a scrollbar for the frame:
Only when the frame's content is larger than its dimensions.
Always show a scrollbar.
Never show a scrollbar.
Inline frames, like
20 elements, are included in the
21 pseudo-array.
With the DOM
22 object, scripts can access the
23 object of the framed resource via the
24 property. The
25 property refers to the
26 inside the , same as
28.
From the inside of a frame, a script can get a reference to its parent window with
29.
Script access to a frame's content is subject to the same-origin policy. Scripts cannot access most properties in other
23 objects if the script was loaded from a different origin, including scripts inside a frame accessing the frame's parent. Cross-origin communication can be achieved using
31.
As a replaced element, the position, alignment, and scaling of the embedded document within the element's box, can be adjusted with the
33 and
34 properties.
The
35 and
36 events fired on `s could be used to probe the URL space of the local network's HTTP servers. Therefore, as a security precaution user agents do not fire the error event on
s, and the load event is always triggered even if the
` content fails to load.
This example embeds the page at //example.org in an iframe.
HTML
Result
People navigating with assistive technology such as a screen reader can use the
42 attribute on an to label its content. The title's value should concisely describe the embedded content:
Without this title, they have to navigate into the to determine what its embedded content is. This context shift can be confusing and time-consuming, especially for pages with multiple ``s and/or if embeds contain interactive content like video or audio.
Content categories , , embedded content, interactive content, palpable content. Permitted content None. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts embedded content. Implicit ARIA role Permitted ARIA roles
46,
26,
48,
49,
50 DOM interface
22