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

Q1048 How can I close the child window when I close its opener?

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

Q1048 How can I close the child window when I close its opener?

Use the window handle:

<script language="JavaScript"><!--
var windowHandle = -1;

function myOpen() {
    windowHandle = window.open('page.htm','windowName','width=640,height=480');
}

function myClose() {
    if (windowHandle != -1)
        windowHandle.close();
    setTimeout('self.close()',1000); // 1 second delay before closing self
}
//--></script>

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.