HOWTO: Closing an window in Internet Explorer without the security dialog

This question had come up the other day and thought others might find this useful.

When you call the window.close() method, Internet Explorer checks whether the opener value is the same as the calling window. If it's not, then the user is prompted with a security dialog asking whether they really want to close the window.

You can work around this by setting the property yourself and thus tricking IE into closing without a prompt.

<FONT color=#0000ff><SCRIPT>
function closeThisWindow()
{
    window.opener = window;
    window.close();
}
</SCRIPT></FONT>

(Not tested in Firefox)


Syndicated from HOWTO: Closing an window in Internet Explorer without the security dialog from Loosely Coupled (RSS)
Published Tuesday, February 01, 2005 5:21 PM by Tim Marman

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)