window.openerrefers to the window that calledwindow.open( ... )to open the window from which it’s calledwindow.parentrefers to the parent of a window in a<frame>or<iframe>window.toprefers to the top-most window from a window nested in one or more layers of<iframe>sub-windows
Those will be null (or maybe undefined) when they’re not relevant to the referring window’s situation. (“Referring window” means the window in whose context the JavaScript code is run.)