Our volunteers haven't translated this article into Català yet. Join us and help get the job done!
You can also read the article in English (US).

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

Syntax

var topWindow = window.top;

Notes

Where the 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

Specification Status Comment
HTML Living Standard
The definition of 'window.top' in that specification.
Living Standard  
HTML5
The definition of 'window.top' in that specification.
Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
topChrome Full support YesEdge Full support 12Firefox Full support Yes
Notes
Full support Yes
Notes
Notes Starting in Firefox 6, this property is read only, as defined by the standard.
IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
See implementation notes.
See implementation notes.

Document Tags and Contributors

Last updated by: mdnwebdocs-bot,