English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
topA read-only property that returns a reference to the topmost window in the window hierarchy.
In whichwindow.parentThe property returns the direct parent of the current window, while window.top returns the topmost window in the window object hierarchy.
This property is particularly useful when you are handling a window in a child frame of one or more parent frames and want to access the topmost frame set.
window.top
if (window.top == window.self) { // This window is the topmost window }Test and See‹/›
All browsers fully support the top property:
Property | |||||
top | Yes | Yes | Yes | Yes | Yes |
Return Value: | Reference to the topmost window in the window hierarchy |
---|
Window (Window) Reference:window.parent property
Window (Window) Reference:window.self property