.comment-link {margin-left:.6em;}

kHSw

Friday, August 27, 2004

Closing a browser window without the confirmation-prompt

If you want to close the main browser window, Internet Explorer will popup this messagebox:

"The Web page you are viewing is trying to close the window.
Do you want to close this window?"

Internet Explorer is checking the window.opener object to see if the current window has been opened by another window. If not, it will display this question.

So, the little trick is to make sure that the window.opener object differs from undefined ;-)

<script language="javascript">
function CloseWindow() {
window.opener = 'http://kHSw.blogspot.com';
window.close();
}
</script>


3 Comments:

  • Informative, Good post
    Thanks !

    By Anonymous Anonymous, at 7:40 AM  

  • thanks alot!
    mersi!

    By Anonymous Anonymous, at 4:05 PM  

  • Its Not working

    By Anonymous Anonymous, at 2:50 PM  

Post a Comment

<< Home


 
Stefanie Worm is het liefste vrouwtje van de wereld.
Melina is de liefste schatsie van de wereld (Erik De Maeyer).