window.frameElement
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
(<iframe>
や <object>
のような)ウィンドウが埋め込まれた要素を返します。要素がトップレベルであるか異なるスクリプト生成元をもつ文書に埋め込まれるかのいずれかの場合は、 null
を返します。
構文
例
js
var frameEl = window.frameElement;
// 埋め込みの場合、要素の URL が 'http://mozilla.org/' に変わります。
if (frameEl) {
frameEl.src = "http://mozilla.org/";
}
仕様
Specification |
---|
HTML # dom-frameelement-dev |
ブラウザー互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
frameElement |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連項目
window.frames
は、現在のウィンドウの直接のサブフレームを一覧する、配列のようなオブジェクトを返します。window.parent
は、子ウィンドウのframeElement
を含むウィンドウである、親ウィンドウを返します。