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

Q845 From the main window I open a smaller child window, in this child window, if a user selects a link, I want to load the new page in the main browser window and close the child window. How do I do this?

You are here: irt.org | FAQ | JavaScript | Window | Q845 [ previous next ]

In the main window:

<script language="JavaScript"><!--
popup = window.open('popup.htm','windowName','width=100,height=100');
if (!popup.opener)
    popup.opener = self;
//--></script>

In popup.htm:

<script language="JavaScript"><!--
function supressError() {
    return true;
}

function load(url) {
    window.onerror = supressError;
    opener.location.href = url;
    setTimeout('self.close()',1000);
}
//--></script>

<a href="javascript:load('http://www.irt.org')">text link</a>

Feedback on 'Q845 From the main window I open a smaller child window, in this child window, if a user selects a link, I want to load the new page in the main browser window and close the child window. How do I do this?'

©2018 Martin Webb