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>
"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, at 7:40 AM
thanks alot!
mersi!
By Anonymous, at 4:05 PM
Its Not working
By Anonymous, at 2:50 PM
Post a Comment
<< Home