Close the current browser window


Hide your email address from spammers Back to RDP Web Resources MSIE prints only one page

This will produce a text link that, when clicked, will close the current browser window:

<a href="javascript:self.close()">Close the window</a>

produces:

Close the window

If the current window is the original window opened by the user, the user will see a prompt asking whether it's ok to close the window.

But if you use this instead, you may be able to get around that:
(Credit: http://khsw.blogspot.com/2004/08/closing-browser-window-without.html )

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 ;-)


Hide your email address from spammers Back to RDP Web Resources MSIE prints only one page

Content & site maintenance by

Friday The Automatic FAQ Maker