Web/API/HTMLIFrameElement

From Get docs


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 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: srcdoc, sandbox, and contentWindow.

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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

align

Deprecated'

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'

Alternate Name' Uses the non-standard name: mozAllowFullScreen

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'

Alternate Name' Uses the non-standard name: mozAllowFullScreen

Opera Android

Full support 25

Safari iOS

Full support 10

Samsung Internet Android

Full support 3.0

allowPaymentRequest

Experimental'Deprecated'Non-standard'

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 15

Firefox

Full support 56

IE

No support No

Opera

No support No

Safari

?

WebView Android

No support No

Chrome 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 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

csp

Experimental'

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

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 No

Opera 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 No

WebView 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 No

Samsung Internet Android

Full support 11.0

frameBorder

Deprecated'

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

longDesc

Deprecated'

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

marginHeight

Deprecated'

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

marginWidth

Deprecated'

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

Notes'

Full support 43

Notes'

Notes' Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.

Edge

Full support 12

Firefox 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 6

WebView 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 Yes

Samsung 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 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

setNfcFocus

Non-standard'

Chrome

No support No

Edge

No support No

Firefox No support No

Notes'

No support No

Notes'

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>