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

Q1252 How do I close a pop-up window if I only have the name of the frame?

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

Q1252 How do I close a pop-up window if I only have the name of the frame?

You can open a new file in the window you want to close by calling window.open('empty.html', 'nameOfWindow') within the main window. Place a window.close() call in empty.html. This will make the first window to open the empty.html in the window you want to close, empty.html will then close the window by itself. Not the best solution perhaps - but it works!

Within the main window:

<script language="JavaScript"> 
// <!--
    window.open('empty.html', 'nameOfWindow');
//-->
</script>

Within empty.html:

<script language="JavaScript"> 
// <!--
    window.close();
//-->
</script>

Submitted by John K. Son


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.