files/en-us/web/api/window/frameelement/index.md
{{ApiRef}}
The Window.frameElement property
returns the element (such as {{HTMLElement("iframe")}} or {{HTMLElement("object")}})
in which the window is embedded.
[!NOTE] Despite this property's name, it works for documents embedded within any embedding point, including {{HTMLElement("object")}}, {{HTMLElement("iframe")}}, or {{HTMLElement("embed")}}.
The element which the window is embedded into. If the window isn't embedded into
another document, or if the document into which it's embedded has a different
{{glossary("origin")}}, the value is null instead.
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}}
{{Compat}}
frameElement of the child window.