window.close fails when clicking links within opened window

I am opening a new window with window.open(). If I do NOTHING else on this page, and click the "close window" link, the window closes. This works perfectly; however, if I navigate between pages(all under the same domain) window.close() no longer works.

Is there a way to fix this?

Here is how I am opening pages in this example…

<a href="###" target="_blank">

Here is my close link:

<a href="javascript:void(0)" onclick="window.close()">close</a>

I use 2 methods of changing pages within the opened windows.

<select onchange="if (this.value) window.location.href=this.value"> AND STANDARD <a href="####"> tag

Do I need to navigate links within this window a certain way to still maintain my window.close() ability?

86 thoughts on “window.close fails when clicking links within opened window”

Leave a Comment