alert(window); // object Window alert(window.window); // object Window alert(window.window.window); // object Window alert(window.window.window === window); // true
A fun bit about this is the window object is read-only, while the self object, also referring to the current opened window, is not.
// Try assigning window to null window = null; alert(window); // object Window window.window = null; alert(window.window); // object Window // Try assigning self to null window.self = null; // only on IE 6, 7 this will returns exception: 'Not Implemented' alert(window.self) // on other browsers, self now is null. alert(window) // object Window .
This proves that self object actually is just a reference of window. And self could be assigned to point to other objects while window remains intact.
Just my 2 cents with window on Firefox :)