The DOM and all the functions from the parent window are then accessible from the popup/child window via window.opener.

For example, if the parent window contained a function called "foo", it could be called from the popup window like so:

window.opener.foo();

Testing if the parent window exists, and is still open

If a property, method etc is accessed using window.opener and it is not a popup window, then a Javascript error will occur and other scripts on the page may no longer run. To test if the opener exists (and therefore whether this is a popup window) test for window.opener first:

if(window.opener) {
// do something
}

Even better, it's also possible to test if the parent window is still open as well: