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.

返回对窗口层次结构中最顶层窗口的引用。

对最顶层窗口的引用。

备注

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.