Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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?

irt.org | Knowledge Base | JavaScript | Window | Q845 [ previous next ]

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?

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.