W3cubDocs

/DOM

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.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 compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes 1 Yes Yes Yes
addNextPaintListener No No 47
47
Supported in chrome code only.
No No No
align 43 Yes Yes ? Yes 6
allow 60 ? ? ? 53 ?
allowFullScreen 17
Prefixed
17
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Daily test builds only.
Yes 18
18
9
Prefixed
Prefixed Implemented with the vendor prefix: moz
No No No
allowPaymentRequest 60
Disabled
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.
15 56 ? No ?
clearMatch No No 47
47
Supported in chrome code only.
No No No
contentDocument 43 Yes Yes 8 Yes 10
contentWindow 43 Yes Yes Yes Yes 6
csp 61 ? ? ? 48 ?
download No No 47
47
Supported in chrome code only.
No No No
executeScript No No 47
47
Supported in chrome code only.
No No No
findAll No No 47
47
Supported in chrome code only.
No No No
findNext No No 47
47
Supported in chrome code only.
No No No
frameBorder 43 Yes Yes ? Yes 6
getActive No No 47
47
Supported in chrome code only.
No No No
getCanGoBack No No 47
47
Supported in chrome code only.
No No No
getCanGoForward No No 47
47
Supported in chrome code only.
No No No
getContentDimensions No No 47
47
Supported in chrome code only.
No No No
getManifest No No 47
47
Supported in chrome code only.
No No No
getMuted No No 47
47
Supported in chrome code only.
No No No
getScreenshot No No 47
47
Supported in chrome code only.
No No No
getStructuredData No No 47
47
Supported in chrome code only.
No No No
getVisible No No 47
47
Supported in chrome code only.
No No No
getVolume No No 47
47
Supported in chrome code only.
No No No
goBack No No 47
47
Supported in chrome code only.
No No No
goForward No No 47
47
Supported in chrome code only.
No No No
height 43 Yes Yes ? Yes 6
longDesc 43 Yes Yes ? Yes 6
marginHeight 43 Yes Yes ? Yes 6
marginWidth 43 Yes Yes ? Yes 6
mute No No 47
47
Supported in chrome code only.
No No No
name 43 Yes Yes ? Yes 6
policy 69
Disabled
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.
No No No 56
Disabled
56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
No
purgeHistory No No 47
47
Supported in chrome code only.
No No No
referrerPolicy 51 No 50 No 38 11.1
reload No No 47
47
Supported in chrome code only.
No No No
removeNextPaintListener No No 47
47
Supported in chrome code only.
No No No
sandbox 43
43
Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Yes 17
17
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.
? Yes
Yes
Before Opera 37, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
6
scrolling 43 Yes Yes ? Yes 6
sendMouseEvent No No 47
47
Supported in chrome code only.
No No No
sendTouchEvent No No 47
47
Supported in chrome code only.
No No No
setActive No No 47
47
Supported in chrome code only.
No No No
setNfcFocus No No No
No
Supported in chrome code only since Firefox version 47.
No No No
setVisible No No 47
47
Supported in chrome code only.
No No No
setVolume No No 47
47
Supported in chrome code only.
No No No
src 43 Yes Yes ? ? 6
srcdoc 43 Yes 25 No ? 6
stop No No 47
47
Supported in chrome code only.
No No No
unmute No No 47
47
Supported in chrome code only.
No No No
width 43 Yes Yes ? Yes 6
zoom No No 47
47
Supported in chrome code only.
No No No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes 4 Yes ? ?
addNextPaintListener No No No No No No ?
align Yes Yes ? ? Yes ? ?
allow 66 66 ? ? 53 ? ?
allowFullScreen Yes
Prefixed
Yes
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Daily test builds only.
18
Prefixed
18
Prefixed
Prefixed Implemented with the vendor prefix: webkit
Daily test builds only.
Yes 18
18
9
Prefixed
Prefixed Implemented with the vendor prefix: moz
No ? ?
allowPaymentRequest No 61
Disabled
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.
? ? No ? ?
clearMatch No No No No No No ?
contentDocument Yes Yes ? 4 Yes Yes ?
contentWindow Yes Yes Yes Yes Yes Yes ?
csp 61 61 ? ? 48 ? ?
download No No No No No No ?
executeScript No No No No No No ?
findAll No No No No No No ?
findNext No No No No No No ?
frameBorder Yes Yes ? ? Yes ? ?
getActive No No No No No No ?
getCanGoBack No No No No No No ?
getCanGoForward No No No No No No ?
getContentDimensions No No No No No No ?
getManifest No No No No No No ?
getMuted No No No No No No ?
getScreenshot No No No No No No ?
getStructuredData No No No No No No ?
getVisible No No No No No No ?
getVolume No No No No No No ?
goBack No No No No No No ?
goForward No No No No No No ?
height Yes Yes ? ? Yes ? ?
longDesc Yes Yes ? ? Yes ? ?
marginHeight Yes Yes ? ? Yes ? ?
marginWidth Yes Yes ? ? Yes ? ?
mute No No No No No No ?
name Yes Yes ? ? Yes ? ?
policy No 69
Disabled
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.
No No 56
Disabled
56
Disabled
Disabled From version 56: this feature is behind the #enable-experimental-productivity-features preference (needs to be set to Enabled).
No ?
purgeHistory No No No No No No ?
referrerPolicy 51 51 No 50 38 No ?
reload No No No No No No ?
removeNextPaintListener No No No No No No ?
sandbox Yes
Yes
Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
18
18
Before Chrome 50, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
Yes 17
17
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.
Yes
Yes
Before Opera 37, this property returned the deprecated child DOMSettableTokenList instead of DOMTokenList.
? ?
scrolling Yes Yes ? ? Yes ? ?
sendMouseEvent No No No No No No ?
sendTouchEvent No No No No No No ?
setActive No No No No No No ?
setNfcFocus No No No No No No ?
setVisible No No No No No No ?
setVolume No No No No No No ?
src Yes Yes ? ? ? ? ?
srcdoc Yes 18 Yes 25 ? ? ?
stop No No No No No No ?
unmute No No No No No No ?
width Yes Yes ? ? Yes ? ?
zoom No No No No No No ?

See also

  • The HTML element implementing this interface: <iframe>

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement