You are here: irt.org | FAQ | JavaScript | Window | Q1252 [ previous next ]
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