Back to Content

Window: top property

files/en-us/web/api/window/top/index.md

latest554 B
Original Source

{{APIRef}}

Returns a reference to the topmost window in the window hierarchy.

Value

The reference to the topmost window.

Notes

Where the {{domxref("window.parent")}} property returns the immediate parent of the current window, window.top returns the topmost window in the hierarchy of window objects.

This property is especially useful when you are dealing with a window that is in a subframe of a parent or parents, and you want to get to the top-level frameset.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}