window.top

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.

ウィンドウ階層における最上位のウィンドウへの参照を返します。

構文

var topWindow = window.top;

注記

window.parent プロパティは、現在のウィンドウの直近の親を返しますが、window.top は、ウィンドウオブジェクトの階層における最上位のウィンドウを返します。

このプロパティは、親、あるいは、階層になっているウィンドウのサブフレーム内にあるウィンドウを扱っていて、最上位のフレームセットを取得したいときに特に役立ちます。

仕様

Specification
HTML
# dom-top-dev

ブラウザー互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
top

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.