In this section, we will learn what the top property is and how to use it in JavaScript.
JavaScript Window top Property
In a webpage, there might be multiple frames created via the `iframe` element. Each of these frames represents a window object.
Sometimes, however, we want to know the main or basically the outer most window object on the page. This is where we can use the `top` property.
The `top` property will return the outermost window object in a webpage, which is the browser window itself.
Note: this property is read-only.
Window top Property Syntax:
window.top
Example: using Window top property in JavaScript
See the Pen using Window top property in JavaScript by Omid Dehghan (@odchan1) on CodePen.
Output:
This is not the outermost window!