Microsoft KB Archive/884768

= BUG: You cannot close an Internet Explorer window by using the window.setTimeout(window.close,1) method in Windows XP Service Pack 2 =

Article ID: 884768

Article Last Modified on 10/11/2004

-

APPLIES TO


 * Microsoft Windows XP Professional
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Service Pack 2
 * Microsoft Windows XP Service Pack 2

-





SYMPTOMS
When you click a hyperlink that is designed to close a Microsoft Internet Explorer window, the Internet Explorer window does not close. This problem occurs in Microsoft Windows XP Service Pack 2.



CAUSE
The hyperlink uses the window.setTimeout(window.close,1) method to close the Internet Explorer window.



WORKAROUND
To work around this problem, use the window.setTimeout(&quot;window.close&quot;, 1) method or the window.close method to close the Internet Explorer window.

You can use the following code sample to demonstrate the workaround.

function TimeoutCloseWindow2 {   window.setTimeout(&quot;window.close&quot;, 1); } function DirectCloseWindow {   window.close; } Workaround 1: Click here to try to close the window by using window.setTimeout(&quot;window.close&quot;, 1) Workaround 2: Click here to try to close the window by using window.close



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the problem
 Click Start, click Run, type Notepad, and then click OK.  Put the following code sample in Notepad. function TimeoutCloseWindow {   window.setTimeout(window.close, 1); } Click here to try to close the window by using window.setTimeout(window.close, 1) </li> Save the file as Repro.html.</li> Use Internet Explorer to open the Repro.html file.

Note If Internet Explorer displays the following message, click the message, and then click Allow Blocked Content.

To help protect your security, Internet Explorer has restricted this file from showing active content that could access your computer. Click here for options.

</li> Click the Click here to attempt to close window using window.setTimeout(window.close, 1) hyperlink.

You expect the Internet Explorer window to close. However, the Internet Explorer window does not close.</li></ol>

Additional query words: IE Windows XP SP2 close

Keywords: kbtshoot kbbug kbscript kbwebbrowser kbhtml KB884768

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.