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.

Properties

Inherits properties from its parent, HTMLElement.

HTMLIFrameElement.align
Is a DOMString that 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 self and src which represent the origin in the iframe's src attribute. The default value is src.
HTMLIFrameElement.allowfullscreen
Is a Boolean indicating whether the inline frame is willing to be placed into full screen mode. See Using full-screen mode for details.
HTMLIFrameElement.allowPaymentRequest
Is a Boolean indicating whether the Payment Request API may be invoked inside a cross-origin iframe.
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.csp
Specifies the Content Security Policy that an embedded document must agree to enforce upon itself.
HTMLIFrameElement.frameBorder
Is a DOMString that indicates whether to create borders between frames.
HTMLIFrameElement.height
Is a DOMString that reflects the height HTML attribute, indicating the height of the frame.
HTMLIFrameElement.longDesc
Is a DOMString that contains the URI of a long description of the frame.
HTMLIFrameElement.marginHeight
Is a DOMString being the height of the frame margin.
HTMLIFrameElement.marginWidth
Is a DOMString being the width of the frame margin.
HTMLIFrameElement.name
Is a DOMString that reflects the name HTML attribute, containing a name by which to refer to the frame.
HTMLIFrameElement.policy Read only
Returns the Policy interface which provides a simple API for introspecting the feature policies applied to a specific document.
HTMLIFrameElement.referrerPolicy
Is a DOMString that reflects the referrerpolicy HTML attribute indicating which referrer to use when fetching the linked resource.
HTMLIFrameElement.sandbox
Is a DOMSettableTokenList that reflects the sandbox HTML attribute, indicating extra restrictions on the behavior of the nested content.
HTMLIFrameElement.scrolling
Is a DOMString that indicates whether the browser should provide scrollbars for the frame.
HTMLIFrameElement.src
Is a DOMString that reflects the src HTML attribute, containing the address of the content to be embedded.
HTMLIFrameElement.srcdoc
Is a DOMString that represents the content to display in the frame.
HTMLIFrameElement.width
Is a DOMString that reflects the width HTML attribute, indicating the width of the frame.

Methods

Inherits properties from its parent, HTMLElement.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLIFrameElement' in that specification.
Living Standard The following property has been added: allowFullscreen.
HTML5
The 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: srcdoc, sandbox, and contentWindow.
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'HTMLIFrameElement' in that specification.
Obsolete The contentDocument property has been added.
Document Object Model (DOM) Level 1 Specification
The definition of 'HTMLIFrameElement' in that specification.
Obsolete Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
align
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
allowChrome Full support 60Edge ? Firefox ? IE ? Opera Full support 53Safari ? WebView Android Full support 66Chrome Android Full support 66Edge Mobile ? Firefox Android ? Opera Android Full support 53Safari iOS ? Samsung Internet Android ?
allowFullScreen
Experimental
Chrome Full support 17
Prefixed Notes
Full support 17
Prefixed Notes
Prefixed Implemented with the vendor prefix: webkit
Notes Daily test builds only.
Edge Full support YesFirefox Full support 18
Full support 18
Full support 9
Prefixed
Prefixed Implemented with the vendor prefix: moz
IE No support NoOpera No support NoSafari No support NoWebView Android Full support Yes
Prefixed Notes
Full support Yes
Prefixed Notes
Prefixed Implemented with the vendor prefix: webkit
Notes Daily test builds only.
Chrome Android Full support 18
Prefixed Notes
Full support 18
Prefixed Notes
Prefixed Implemented with the vendor prefix: webkit
Notes Daily test builds only.
Edge Mobile Full support YesFirefox Android Full support 18
Full support 18
Full support 9
Prefixed
Prefixed Implemented with the vendor prefix: moz
Opera Android No support NoSafari iOS ? Samsung Internet Android ?
allowPaymentRequest
Experimental
Chrome Full support 60
Disabled
Full support 60
Disabled
Disabled From version 60: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Full support 15Firefox Full support 56IE ? Opera No support NoSafari ? WebView Android No support NoChrome Android Full support 61
Disabled
Full support 61
Disabled
Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile ? Firefox Android ? Opera Android No support NoSafari iOS ? Samsung Internet Android ?
contentDocumentChrome Full support 43Edge Full support YesFirefox Full support YesIE Full support 8Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
contentWindowChrome Full support 43Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?
csp
Experimental
Chrome Full support 61Edge ? Firefox ? IE ? Opera Full support 48Safari ? WebView Android Full support 61Chrome Android Full support 61Edge Mobile ? Firefox Android ? Opera Android Full support 48Safari iOS ? Samsung Internet Android ?
frameBorder
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
heightChrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
longDesc
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
marginHeight
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
marginWidth
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
nameChrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
policy
Experimental
Chrome Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge No support NoFirefox No support NoIE No support NoOpera Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android No support NoChrome Android Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56
Disabled
Full support 56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android ?
referrerPolicyChrome Full support 51Edge No support NoFirefox Full support 50IE No support NoOpera Full support 38Safari Full support 11.1WebView Android Full support 51Chrome Android Full support 51Edge Mobile No support NoFirefox Android Full support 50Opera Android Full support 38Safari iOS No support NoSamsung Internet Android ?
sandboxChrome Full support 43
Notes
Full support 43
Notes
Notes Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Edge Full support YesFirefox Full support 17
Notes
Full support 17
Notes
Notes Previously, the type of sandbox 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.
IE ? Opera Full support Yes
Notes
Full support Yes
Notes
Notes Before Opera 37, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Safari Full support 6WebView Android Full support Yes
Notes
Full support Yes
Notes
Notes Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Chrome Android Full support 18
Notes
Full support 18
Notes
Notes Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Edge Mobile Full support YesFirefox Android Full support 17
Notes
Full support 17
Notes
Notes Previously, the type of sandbox 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.
Opera Android Full support Yes
Notes
Full support Yes
Notes
Notes Before Opera 37, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Safari iOS ? Samsung Internet Android ?
scrolling
Deprecated
Chrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
setNfcFocus
Non-standard
Chrome No support NoEdge No support NoFirefox No support No
Notes
No support No
Notes
Notes Supported in chrome code only since Firefox version 47.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android ?
srcChrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera ? Safari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
srcdocChrome Full support 43Edge Full support YesFirefox Full support 25IE No support NoOpera ? Safari Full support 6WebView Android Full support YesChrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 25Opera Android ? Safari iOS ? Samsung Internet Android ?
widthChrome Full support 43Edge Full support YesFirefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android ? Opera Android Full support YesSafari iOS ? Samsung Internet Android ?

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.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

  • The HTML element implementing this interface: <iframe>

Document Tags and Contributors

Last updated by: sideshowbarker,