This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The HTMLIFrameElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements.
Inherits properties from its parent, HTMLElement.
HTMLIFrameElement.align Deprecated
A string that specifies the alignment of the frame with respect to the surrounding context.
HTMLIFrameElement.allowA string that indicates the Permissions Policy specified for this <iframe>.
HTMLIFrameElement.allowFullscreenA boolean value indicating whether the inline frame is willing to be placed into full screen mode. See Using fullscreen mode for details.
HTMLIFrameElement.allowPaymentRequest Deprecated Non-standard
A boolean value indicating whether the Payment Request API may be invoked inside a cross-origin iframe.
HTMLIFrameElement.browsingTopics Experimental Non-standard
A boolean property specifying that the selected topics for the current user should be sent with the request for the associated <iframe>'s source. This reflects the browsingtopics content attribute value.
HTMLIFrameElement.contentDocument Read only
Returns a Document, the active document in the inline frame's nested browsing context.
HTMLIFrameElement.contentWindow Read only
Returns a WindowProxy, the window proxy for the nested browsing context.
HTMLIFrameElement.credentialless Experimental
A boolean value indicating whether the <iframe> is credentialless, meaning that its content is loaded in a new, ephemeral context. This context does not have access to the parent context's shared storage and credentials. In return, the Cross-Origin-Embedder-Policy (COEP) embedding rules can be lifted, so documents with COEP set can embed third-party documents that do not. See IFrame credentialless for a deeper explanation.
HTMLIFrameElement.csp Experimental
Specifies the Content Security Policy that an embedded document must agree to enforce upon itself.
HTMLIFrameElement.featurePolicy Read only Experimental
Returns the FeaturePolicy interface which provides a simple API for introspecting the Permissions Policies applied to a specific document.
HTMLIFrameElement.frameBorder Deprecated
A string that indicates whether to create borders between frames.
HTMLIFrameElement.heightA string that reflects the height HTML attribute, indicating the height of the frame.
HTMLIFrameElement.loadingA string providing a hint to the browser that the iframe should be loaded immediately (eager) or on an as-needed basis (lazy). This reflects the loading HTML attribute.
HTMLIFrameElement.longDesc Deprecated
A string that contains the URI of a long description of the frame.
HTMLIFrameElement.marginHeight Deprecated
A string being the height of the frame margin.
HTMLIFrameElement.marginWidth Deprecated
A string being the width of the frame margin.
HTMLIFrameElement.nameA string that reflects the name HTML attribute, containing a name by which to refer to the frame.
HTMLIFrameElement.referrerPolicyA string that reflects the referrerPolicy HTML attribute indicating which referrer to use when fetching the linked resource.
HTMLIFrameElement.sandbox Read only
Returns a DOMTokenList that reflects the sandbox HTML attribute, indicating extra restrictions on the behavior of the nested content.
HTMLIFrameElement.scrolling Deprecated
A string that indicates whether the browser should provide scrollbars for the frame.
HTMLIFrameElement.srcA string that reflects the src HTML attribute, containing the address of the content to be embedded. Note that programmatically removing an <iframe>'s src attribute (e.g., via Element.removeAttribute()) causes about:blank to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS.
HTMLIFrameElement.srcdocA string that represents the content to display in the frame.
HTMLIFrameElement.widthA string that reflects the width HTML attribute, indicating the width of the frame.
Also inherits methods from its parent interface, HTMLElement.
HTMLIFrameElement.getSVGDocument()Returns the embedded SVG as a Document.
| Specification |
|---|
| HTML> # htmliframeelement> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
HTMLIFrameElement |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 3 | 1 |
adAuctionHeaders |
122 | 122 | No | 108 | No | 122 | No | 81 | No | 26.0 | 122 | No |
align |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
allow |
60 | 79 | 74 | 47 | 11.1 | 60 | 79 | 44 | 11.3 | 8.0 | 60 | 11.3 |
allowFullscreen |
38 | 12 | 229–18 | 25 | 10.1 | 38 | 229–18 | 25 | 12["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."] |
3.0 | 38 | 12["Only available on iPad, not on iPhone.", "Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games."] |
allowPaymentRequest |
60 | 15 | 56–83 | 47 | No | 57 | 56–83 | 43 | No | 7.0 | No | No |
browsingTopics |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
contentDocument |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
contentWindow |
1 | 12 | 1 | 8 | 3 | 18 | 4 | 10.1 | 1 | 1.0 | 4.4 | 1 |
credentialless |
110 | 110 | No | 96 | No | 110 | No | 74 | No | 21.0 | 110 | No |
csp |
61 | 79 | No | 48 | No | 61 | No | 45 | No | 8.0 | 61 | No |
featurePolicy |
74 | 79 | 69 | 62 | No | 74 | No | 53 | No | 11.0 | 74 | No |
frameBorder |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
getSVGDocument |
1 | 12 | 3.5 | ≤12.1 | 3.1 | 18 | 4 | ≤12.1 | 2 | 1.0 | 3 | 2 |
height |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
loading |
77 | 79 | 121 | 60 | 16.4 | 77 | 121 | 55 | 16.4 | 12.0 | 77 | 16.4 |
longDesc |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
marginHeight |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
marginWidth |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
name |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
privateToken |
117 | 117 | No | 103 | No | 117 | No | 78 | No | 24.0 | 117 | No |
referrerPolicy |
5251–52 | 79 | 50 | 3938–39 | 14 | 5251–52 | 50 | 41 | 14 | 6.05.0–6.0 | 5251–52 | 14 |
sandbox |
5Before Chrome 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
12 | 17Previously, the type ofsandbox was a DOMString instead of a DOMSettableTokenList. This has been fixed with Firefox 29. Other browsers may still implement the property as DOMString since it was a late change in the specification. |
15Before Opera 37, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
5 | 18Before Chrome Android 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
17Previously, the type ofsandbox was a DOMString instead of a DOMSettableTokenList. This has been fixed with Firefox for Android 29. Other browsers may still implement the property as DOMString since it was a late change in the specification. |
14Before Opera Android 37, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
4 | 1.0Before Samsung Internet 5.0, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
4.4Before WebView Android 50, this property returned the deprecated childDOMSettableTokenList instead of DOMTokenList. |
4 |
scrolling |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
sharedStorageWritable |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
src |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
srcdoc |
20 | 79 | 25 | 15 | 6 | 25 | 25 | 14 | 6 | 1.5 | 4.4 | 6 |
width |
1 | 12 | 1 | ≤12.1 | 3 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
<iframe>
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement