English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Window frameElement property

JavaScript Window Object

frameElementA read-only attribute that returns the element (such as <iframe> or <object>) in which the embedded window is.

If the document window is not placed inside an <iframe> or <object>, the return value of this attribute isnull.

Although it has this attribute name, it still applies to documents embedded in any embedding point, including <object>, <iframe>, or <embed>.

Note:This property also applies to the <frame> element. However, HTML5The <frame> element is not supported.

Syntax:

window.frameElement
var myframe = window.frameElement;
  
if (myframe) { 
   myframe.src = "https://www.oldtoolbag.com/";
}
Test See‹/›

Browser Compatibility

All browsers fully support the frameElement property:

Property
frameElementYesYesYesYesYes

Technical Details

Return Value:The IFrame object, which is the host of the current window in the parent document, or null otherwise

Related References

Window (Window) Reference:window.frames Property

Window (Window) Reference:window.parent Property

Tag Reference:HTML <embed> Tag

Tag Reference:HTML <object> Tag

Tag Reference:HTML <iframe> Tag

JavaScript Window Object