Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
window
is the global object, so properties on it can be accessed as if they were standalone variables. So referencing
top
on the top level is the same as referencing
window.top
. So the question boils down to the difference is between
window.top
window.top.window
window.top
gives you a window object (it may be the same as window
, or it may be an outer window, if you're in an iframe), and a window's window
property is a reference to the same window
object (it's a weird self-reference), so those two references are exactly the same as well. You can count on
window.top === window.top.window
to always be true
.
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.