Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q121 Is it possible to address the frame structure from outside of itself, from an opened child window?

You are here: irt.org | FAQ | JavaScript | Frame | Q121 [ previous next ]

All you need is a reference back to the frame/window that opened the new window.

When opening the window using window.open, the new window is a child of the first window, although the first window is not the parent of the new window.

Make sure the window opening looks something like this:

<SCRIPT LANGUAGE="JavaScript"><!--
// This creates the popup window.
function MakeWindow() {
    myWindow=window.open('','windowName','add you list of properties in here');
    myWindow.href = 'apage.html';
    if (!myWindow.opener) myWindow.opener = self;
}
//--></SCRIPT>

Then you can refer to the opener as opener:

alert(opener.location.href);

©2018 Martin Webb