Close Window Without Warning Message - Javascript
If you have ever tried to close a window and receive this warning "The page is trying to close the window", this warning message shows up everytime we use window.close(). to solve this issue we have to look at how window.close() works
window.close() looks to the opener window, if it's equal to empty string it displays this kind of message, so to bypass this all you need to is to set the opener to a string and then use the close() function
<script language="javascript">
function CloseWindow()
{
window.opener = 'as'; // Or window.opener = self;
window.close()
}
</script>