Internet Explorer 10 freezes when you close a webpage during an XHR request

Symptoms
Consider the following scenario:
  • You browse to a certain webpage by using Internet Explorer 10.
  • The webpage contains a script that makes an asynchronous XMLHttpRequest (XHR) request when the webpage is opened.
  • You close the webpage during the XHR request.
  • The response for the XHR request is larger than 2 KB (including the header data).
In this scenario, you may lose an HTTP connection to the given host. Then, when you try to browse to another webpage on the host, you may experience a network freeze. This issue occurs when you lose the maximum number of concurrent connections to the host.

Note This issue occurs in Internet Explorer 7, Internet Explorer 8 and Internet Explorer 9 document modes in Internet Explorer 10.
Resolution

Security update information

To resolve this issue in Internet Explorer 9 or Internet Explorer 10, install the most recent cumulative security update for Internet Explorer. To do this, go to the following Microsoft website:
Notes
  • This update for Internet Explorer 10 was first included in the following security update:
    2838727 MS13-047: Cumulative Security Update for Internet Explorer: June 11, 2013
  • To install this update for Internet Explorer 9, click the following article number to view the article in the Microsoft Knowledge Base:

    2905733 Internet Explorer loses HTTP connections when you close a webpage before you receive an XHR response
  • For more technical information about the most recent cumulative security update for Internet Explorer, go to the following Microsoft websites: 
Workaround
To work around this issue, you can use one of the following methods:
  1. Change the XHR request to a synchronous request.

    Note
     This workaround is against best programming practices and may cause the web browser to freeze if there is no response. For more information, see Why You Should Use XMLHttpRequest Asynchronously.

    To avoid a Windows Internet (WinINet) connection leak together with AJAX, you can end the existing connection before the window closes.

    Note For more information about how to work around the connection leak, click the following article number to view the article in the Microsoft Knowledge Base:
    886710 Internet Explorer appears to stop responding, and you may also notice a memory leak on the computer
  2. Replace the window.open method with the window.showModalDialog method.

    Note
    this workaround prevents user interaction with the parent window until the child window is closed.
  3. End existing asynchronous XHR requests from the OnUnLoad event. For example:
    function unloadEventHandler() { if (g_xmlHttpRequest != null && g_xmlHttpRequest.readyState != 4) { g_xmlHttpRequest.abort(); } } 
  4. Do not make asynchronous XHR calls from the OnUnLoad event.

    Note Even if you make the calls from the OnLoad event this issue may still occur.
  5. Upgrade to Internet Explorer 10 and make sure that you use the native XHR implementation.
  6. Increase the maximum number of connections.
More information
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Properties

Article ID: 2856746 - Last Review: 11/20/2013 02:31:00 - Revision: 3.0

Internet Explorer 10

  • kbqfe kbfix kbbug kbexpertiseadvanced kbexpertiseinter kbsurveynew KB2856746
Feedback