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 frame is allowed to display content from. This attribute also accepts the values
self
andsrc
which represent the origin in the iframe's src attribute. The default value issrc
. -
HTMLIFrameElement.allowfullscreen
-
Is a boolean value 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 value 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 theheight
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 thename
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 thereferrerpolicy
HTML attribute indicating which referrer to use when fetching the linked resource. HTMLIFrameElement.sandbox
-
Is a
DOMSettableTokenList
that reflects thesandbox
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 thesrc
HTML attribute, containing the address of the content to be embedded. Note that programmatically removing an<iframe>
's src attribute (e.g. viaElement.removeAttribute()
) causesabout: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 thewidth
HTML attribute, indicating the width of the frame.
Methods
Inherits properties from its parent, HTMLElement
.
Specifications
Specification |
---|
HTML Standard (HTML) # htmliframeelement |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
HTMLIFrameElement |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
align |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
allow |
60 |
79 |
74 |
No |
53 |
11.1 |
66 |
66 |
79 |
47 |
11.3 |
9.0 |
allowFullscreen |
38 |
12 |
22
9-18
|
No |
25 |
10.1 |
38 |
38 |
22
9-18
|
25 |
12
Only available on iPad, not on iPhone.
|
3.0 |
allowPaymentRequest |
60 |
15 |
56-83 |
No |
No |
No |
No |
61 |
56-83 |
No |
No |
No |
contentDocument |
1 |
12 |
1 |
8 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
contentWindow |
1 |
12 |
1 |
5.5 |
8 |
3 |
1 |
18 |
4 |
10.1 |
1 |
1.0 |
csp |
61 |
79 |
No |
No |
48 |
No |
61 |
61 |
No |
45 |
No |
8.0 |
featurePolicy |
74 |
79 |
69
65-69
|
No |
62 |
No |
74 |
74 |
65 |
53 |
No |
11.0 |
frameBorder |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
getSVGDocument |
1 |
12 |
3.5 |
9 |
≤12.1 |
3.1 |
≤37 |
18 |
4 |
≤12.1 |
2 |
1.0 |
height |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
loading |
77 |
79 |
No |
No |
60 |
No
See bug 196698.
|
77 |
77 |
No |
55 |
No
See bug 196698.
|
12.0 |
longDesc |
1 |
12 |
1 |
6 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
marginHeight |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
marginWidth |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
name |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
referrerPolicy |
53 |
79 |
50 |
No |
38 |
14 |
53 |
53 |
50 |
41 |
14 |
6.0 |
sandbox |
5
Before Chrome 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
12 |
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. |
10 |
15
Before Opera 37, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
5 |
≤37
Before WebView 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
18
Before Chrome 50, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
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. |
14
Before Opera 37, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
4 |
1.0
Before Samsung Internet 5.0, this property returned the deprecated child
DOMSettableTokenList instead of DOMTokenList . |
scrolling |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
src |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
srcdoc |
20 |
79 |
25 |
No |
15 |
6 |
≤37 |
25 |
25 |
14 |
6 |
1.5 |
width |
1 |
12 |
1 |
5.5 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
See also
- The HTML element implementing this interface:
<iframe>
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement