HTMLIFrameElement

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.featurePolicy Read only
Returns the FeaturePolicy 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. Note that programatically 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.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

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
HTMLIFrameElementChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
align
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
allowChrome Full support 60Edge Full support ≤79Firefox Full support 74IE ? Opera Full support 53Safari Full support YesWebView Android Full support 66Chrome Android Full support 66Firefox Android No support NoOpera Android Full support 47Safari iOS Full support YesSamsung Internet Android Full support 9.0
allowFullscreenChrome Full support 38Edge Full support ≤18Firefox Full support 22
Full support 22
No support 9 — 18
Alternate Name
Alternate Name Uses the non-standard name: mozAllowFullScreen
IE No support NoOpera Full support 25Safari Full support 10WebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 22
Full support 22
No support 9 — 18
Alternate Name
Alternate Name Uses the non-standard name: mozAllowFullScreen
Opera Android Full support 25Safari iOS Full support 10Samsung Internet Android Full support 3.0
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.
Firefox Android Full support YesOpera Android No support NoSafari iOS ? Samsung Internet Android No support No
contentDocumentChrome Full support 43Edge Full support 12Firefox Full support YesIE Full support 8Opera Full support YesSafari Full support 10WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
contentWindowChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 8Opera Full support 8Safari Full support 3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0
csp
Experimental
Chrome Full support 61Edge Full support ≤79Firefox ? IE ? Opera Full support 48Safari ? WebView Android Full support 61Chrome Android Full support 61Firefox Android ? Opera Android Full support 45Safari iOS ? Samsung Internet Android Full support 8.0
featurePolicy
Experimental
Chrome Full support 74
Notes
Full support 74
Notes
Notes Chrome Platform Status incorrectly describes this variable as document.policy. It was renamed in bug 917057 before being shipped in bug 703703.
No support 73 — 74
Disabled
Disabled From version 73 until version 74 (exclusive): this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
No support 69 — 73
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 69 until version 73 (exclusive): 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 Full support 79
Notes
Full support 79
Notes
Notes Edge Platform Status incorrectly describes this variable as document.policy. It was renamed in bug 917057 before being shipped in bug 703703.
Firefox Full support 69
Disabled
Full support 69
Disabled
Disabled From version 69: this feature is behind the dom.security.featurePolicy.webidl.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No support 65 — 69
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 65 until version 69 (exclusive): this feature is behind the dom.security.featurePolicy.webidl.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 62
Full support 62
No support 60 — 62
Disabled
Disabled From version 60 until version 62 (exclusive): this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
No support 56 — 60
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 56 until version 60 (exclusive): this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari No support NoWebView Android Full support 74
Notes
Full support 74
Notes
Notes Chrome Platform Status incorrectly describes this variable as document.policy. It was renamed in bug 917057 before being shipped in bug 703703.
Chrome Android Full support 74
Notes
Full support 74
Notes
Notes Chrome Platform Status incorrectly describes this variable as document.policy. It was renamed in bug 917057 before being shipped in bug 703703.
No support 73 — 74
Disabled
Disabled From version 73 until version 74 (exclusive): this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
No support 69 — 73
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 69 until version 73 (exclusive): this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.
Firefox Android Full support 65
Alternate Name Disabled
Full support 65
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 65: this feature is behind the dom.security.featurePolicy.webidl.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Full support 48
Alternate Name Disabled
Full support 48
Alternate Name Disabled
Alternate Name Uses the non-standard name: policy
Disabled From version 48: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
Safari iOS No support NoSamsung Internet Android Full support 11.0
frameBorder
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
heightChrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
longDesc
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
marginHeight
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
marginWidth
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
nameChrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
referrerPolicyChrome Full support 51Edge Full support 79Firefox Full support 50IE No support NoOpera Full support 38Safari Full support 11.1WebView Android Full support 51Chrome Android Full support 51Firefox Android Full support 50Opera Android Full support 41Safari iOS No support NoSamsung Internet Android Full support 5.0
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 12Firefox 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.
Firefox 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 Full support YesSamsung Internet Android Full support 1.0
Notes
Full support 1.0
Notes
Notes Before Samsung Internet 5.0, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
scrolling
Deprecated
Chrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
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 NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
srcChrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
srcdocChrome Full support 43Edge Full support 79Firefox Full support 25IE No support NoOpera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 25Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 1.0
widthChrome Full support 43Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support 6WebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung 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>