Reputation: 21999
I open a new window and would like to give the user the option of closing the window using a button. I thought window.close() would work, but nothing happens. Below is a copy of my code.
<script type="text/javascript" language="javascript">
function CloseWindow() {
//window.open('', '_self', '');
window.close();
}
</script>
....
<input type="button" value="Close Window" onclick="CloseWindow();" />
Upvotes: 2
Views: 468
Reputation: 298898
window.close()
only works in a window that was opened via javascript (a popup)
Upvotes: 3