Window: frameElement property
The Window.frameElement property
returns the element (such as <iframe> or <object>)
in which the window is embedded.
Value
Examples
js
const frameEl = window.frameElement;
// If we're embedded, change the containing element's URL to 'https://mozilla.org/'
if (frameEl) {
frameEl.src = "https://mozilla.org/";
}
Specifications
| Specification |
|---|
| HTML Standard # dom-frameelement-dev |
Browser compatibility
BCD tables only load in the browser
See also
-
window.framesreturns an array-like object, listing the direct sub-frames of the current window. -
window.parentreturns the parent window, which is the window containing theframeElementof the child window.