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.
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a><polyline points="341,25 351,20 351,30 341,25" stroke="#D4DDE4" fill="none"/><line x1="351" y1="25" x2="381" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement" target="_top"><rect x="381" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="436" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLElement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#D4DDE4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#D4DDE4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#D4DDE4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement" target="_top"><rect x="321" y="65" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLIFrameElement</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
Properties
Inherits properties from its parent, HTMLElement.
HTMLIFrameElement.align'- Is a
DOMStringthat specifies the alignment of the frame with respect to the surrounding context. HTMLIFrameElement.allow'- Is a list of origins the the frame is allowed to display content from. This attribute also accepts the values
selfandsrcwhich represent the origin in the iframe's src attribute. The default value issrc. HTMLIFrameElement.allowfullscreen'- Is a
Booleanindicating whether the inline frame is willing to be placed into full screen mode. See Using full-screen mode for details. HTMLIFrameElement.allowPaymentRequest- Is a
Booleanindicating whether the Payment Request API may be invoked inside a cross-origin iframe. HTMLIFrameElement.contentDocumentRead only- Returns a
Document, the active document in the inline frame's nested browsing context. HTMLIFrameElement.contentWindowRead only- Returns a
WindowProxy, the window proxy for the nested browsing context. HTMLIFrameElement.csp- Specifies the Content Security Policy that an embedded document must agree to enforce upon itself.
HTMLIFrameElement.frameBorder'- Is a
DOMStringthat indicates whether to create borders between frames. HTMLIFrameElement.height- Is a
DOMStringthat reflects theheightHTML attribute, indicating the height of the frame. HTMLIFrameElement.longDesc'- Is a
DOMStringthat contains the URI of a long description of the frame. HTMLIFrameElement.marginHeight'- Is a
DOMStringbeing the height of the frame margin. HTMLIFrameElement.marginWidth'- Is a
DOMStringbeing the width of the frame margin. HTMLIFrameElement.name- Is a
DOMStringthat reflects thenameHTML attribute, containing a name by which to refer to the frame. HTMLIFrameElement.featurePolicyRead only '- Returns the
FeaturePolicyinterface which provides a simple API for introspecting the feature policies applied to a specific document. HTMLIFrameElement.referrerPolicy'- Is a
DOMStringthat reflects thereferrerpolicyHTML attribute indicating which referrer to use when fetching the linked resource. HTMLIFrameElement.sandbox- Is a
DOMSettableTokenListthat reflects thesandboxHTML attribute, indicating extra restrictions on the behavior of the nested content. HTMLIFrameElement.scrolling'- Is a
DOMStringthat indicates whether the browser should provide scrollbars for the frame. HTMLIFrameElement.src- Is a
DOMStringthat reflects thesrcHTML attribute, containing the address of the content to be embedded. Note that programatically removing an<iframe>'s src attribute (e.g. viaElement.removeAttribute()) causesabout:blankto be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS. HTMLIFrameElement.srcdoc- Is a
DOMStringthat represents the content to display in the frame. HTMLIFrameElement.width- Is a
DOMStringthat reflects thewidthHTML attribute, indicating the width of the frame.
Methods
Inherits properties from its parent, HTMLElement.
Specifications
| Specification | Status | Comment |
| HTML Living StandardThe definition of 'HTMLIFrameElement' in that specification. | Living Standard | The following property has been added: allowFullscreen.
|
| HTML5The definition of 'HTMLIFrameElement' in that specification. | Recommendation | The following properties are now obsolete: scrolling, marginWidth, marginHeight, longDesc, frameBorder, and align.
The following properties have been added: |
| Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'HTMLIFrameElement' in that specification. | Obsolete | The contentDocument property has been added.
|
| Document Object Model (DOM) Level 1 SpecificationThe definition of 'HTMLIFrameElement' in that specification. | Obsolete | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
HTMLIFrameElement
|
Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support Yes |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 4 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
allow
|
Chrome
Full support 60 |
Edge
Full support ≤79 |
Firefox
Full support 74 |
IE
No support No |
Opera
Full support 53 |
Safari
Full support Yes |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android
No support No |
Opera Android
Full support 47 |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 9.0 |
allowFullscreen
|
Chrome
Full support 38 |
Edge
Full support ≤18 |
Firefox Full support 22 Full support 22 No support 9 — 18 Alternate Name' Uses the non-standard name: |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 22 Full support 22 No support 9 — 18 Alternate Name' Uses the non-standard name: |
Opera Android
Full support 25 |
Safari iOS
Full support 10 |
Samsung Internet Android
Full support 3.0 |
|
Chrome Full support 60 Full support 60 Disabled' From version 60: this feature is behind the |
Edge
Full support 15 |
Firefox
Full support 56 |
IE
No support No |
Opera
No support No |
Safari
? |
WebView Android
No support No |
Chrome Android Full support 61 Full support 61 Disabled' From version 61: this feature is behind the |
Firefox Android
Full support Yes |
Opera Android
No support No |
Safari iOS
? |
Samsung Internet Android
No support No | |
contentDocument
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
Full support 8 |
Opera
Full support Yes |
Safari
Full support 10 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 4 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
contentWindow
|
Chrome
Full support 1 |
Edge
Full support 12 |
Firefox
Full support 1 |
IE
Full support 8 |
Opera
Full support 8 |
Safari
Full support 3 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android
Full support 4 |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
| Chrome
Full support 61 |
Edge
Full support ≤79 |
Firefox
? |
IE
No support No |
Opera
Full support 48 |
Safari
? |
WebView Android
Full support 61 |
Chrome Android
Full support 61 |
Firefox Android
? |
Opera Android
Full support 45 |
Safari iOS
? |
Samsung Internet Android
Full support 8.0 | |
|
Chrome Full support 74 Full support 74 Notes' Chrome Platform Status incorrectly describes this variable as Disabled' From version 73 until version 74 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Edge Full support 79 Full support 79 Notes' Edge Platform Status incorrectly describes this variable as |
Firefox Full support 69 Full support 69 Disabled' From version 69: this feature is behind the Alternate Name' Uses the non-standard name: |
IE
No support No |
Opera Full support 62 Full support 62 No support 60 — 62 Disabled' From version 60 until version 62 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Safari
No support No |
WebView Android Full support 74 Full support 74 Notes' Chrome Platform Status incorrectly describes this variable as |
Chrome Android Full support 74 Full support 74 Notes' Chrome Platform Status incorrectly describes this variable as Disabled' From version 73 until version 74 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Firefox Android Full support 65 Full support 65 Alternate Name' Uses the non-standard name: |
Opera Android Full support 48 Full support 48 Alternate Name' Uses the non-standard name: |
Safari iOS
No support No |
Samsung Internet Android
Full support 11.0 | |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
height
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
name
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
referrerPolicy
|
Chrome
Full support 51 |
Edge
Full support 79 |
Firefox
Full support 50 |
IE
No support No |
Opera
Full support 38 |
Safari
Full support 11.1 |
WebView Android
Full support 51 |
Chrome Android
Full support 51 |
Firefox Android
Full support 50 |
Opera Android
Full support 41 |
Safari iOS
No support No |
Samsung Internet Android
Full support 5.0 |
sandbox
|
Chrome Full support 43 Full support 43 Notes' Before Chrome 50, this property returned the deprecated child |
Edge
Full support 12 |
Firefox Full support 17 Full support 17 Notes' Previously, the type of |
IE
? |
Opera Full support Yes Full support Yes Notes' Before Opera 37, this property returned the deprecated child |
Safari
Full support 6 |
WebView Android Full support Yes Full support Yes Notes' Before Chrome 50, this property returned the deprecated child |
Chrome Android Full support 18 Full support 18 Notes' Before Chrome 50, this property returned the deprecated child |
Firefox Android Full support 17 Full support 17 Notes' Previously, the type of |
Opera Android Full support Yes Full support Yes Notes' Before Opera 37, this property returned the deprecated child |
Safari iOS
Full support Yes |
Samsung Internet Android Full support 1.0 Full support 1.0 Notes' Before Samsung Internet 5.0, this property returned the deprecated child |
| Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes | |
| Chrome
No support No |
Edge
No support No |
Firefox No support No No support No Notes' Supported in chrome code only since Firefox version 47. |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
No support No |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
No support No | |
src
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
srcdoc
|
Chrome
Full support 43 |
Edge
Full support 79 |
Firefox
Full support 25 |
IE
No support No |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support 18 |
Firefox Android
Full support 25 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 1.0 |
width
|
Chrome
Full support 43 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support 6 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.'
- Deprecated. Not for use in new websites.
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
- Uses a non-standard name.'
- Uses a non-standard name.
See also
- The HTML element implementing this interface:
<iframe>
HTMLIFrameElement by Mozilla Contributors is licensed under CC-BY-SA 2.5.