BUG: Internet Explorer Stops Responding When You Download Images (269802)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 6.0
  • Microsoft Internet Explorer (Programming) 5.01
  • Microsoft Internet Explorer (Programming) 5.01 SP1
  • Microsoft Internet Explorer (Programming) 5.5
  • Microsoft Windows Internet Services (WinInet)

This article was previously published under Q269802

SYMPTOMS

When you browse to a Web site that dynamically adds images to a page, some of those images may intermittently fail to appear. The Internet Explorer icon continues to spin for five minutes in the upper-right corner of the browser as if the browser stops responding (hangs) while it attempts to download the content. You may receive the following error message:
-2147012894 Internet Client Error: Request Timeout.

RESOLUTION

To resolve this problem, you can use one of the following methods:
  • Redesign the Web application to minimize dynamic addition of images to the page.
  • In certain cases, such as the example shown in the "More Information" section, you can recode the Web application to dynamically insert the <IMG> tags by using the innerHTML property without specifying the src property.

    Later, such as on a timer event, the src properties can be changed dynamically to reflect the correct image URL. For example:
    function doLoad()
    	{
    	// After changing the xsl to not include the src for the image tags
    	xslTarget.innerHTML = source.transformNode(style.XMLDocument);
    	window.setTimeout("addImg()",1);
    	
    	}
    	function addImg()
    	{
    		var imgs;
    		imgs = document.body.all.tags("IMG");
    		var srcs=source.selectNodes("//Path");
    		
    		var len=imgs.length;
    		for(i=0;i<len;i++)
    		{
    			imgs[i].src=srcs(i).text;
    		}
    	}
    					
  • Increase the maximum number of connections for each server. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

    183110 INFO: WinInet limits connections per server


    NOTE: This technique increases the connection load on all HTTP servers that Internet Explorer visits and globally forces Internet Explorer go against the HTTP specification. This workaround is only recommended if Internet Explorer hangs frequently, and you cannot change the code for the Web site.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The pages that exhibit this problem differ greatly in design and technique. However, at a basic level, all pages that are known to exhibit this specific problem add images dynamically after the initial page has finished loading. These pages either change the src property of an <IMG> tag or dynamically add <IMG> tags with the innerHTML property or insertAdjacentHTML method.

The following example is a basic page that uses Extensible Markup Language (XML) and innerHTML to illustrate the code that is prone to this bug:
<HTML>
<BODY onload="doLoad()">
<SCRIPT language="JavaScript">
    function doLoad()
    {
        xslTarget.innerHTML = source.transformNode(style.XMLDocument);
    }
</SCRIPT>

<XML id="source">
<Data>

  <Image>
    <Name>Image 1</Name>
    <Path>SomeImage.gif</Path>
  </Image>
  <Image>
    <Name>Image 2</Name>
    <Path>SomeImage.gif</Path>
  </Image> 
  .........
  .........
  <Image>
    <Name>Image 50</Name>
    <Path>SomeImage.gif</Path>
  </Image> 
</Data>
</XML>
<XML id="style">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
    <xsl:apply-templates select="//Image"/>
</xsl:template>
<xsl:template match="Image">
   <P> Some Image
   <img border="0" width="16" height="16">
  	<xsl:attribute name="name"><xsl:value-of select="Name"/></xsl:attribute>
  	<xsl:attribute name="src"><xsl:value-of select="Path"/></xsl:attribute>	
   </img>
   </P>
</xsl:template>
</xsl:stylesheet>
</XML>   	

<DIV id="xslTarget"></DIV>

</BODY>
</HTML>
				
This sample test case is reproducible and uses Extensible Stylesheet Language (XSL) to process the XML data in the XML tag. XSL transforms XML data to visible content. When you set innerHTML on the xslTarget DIV element during the window onload event for this page, an image is added to the page for every "Image" node in the XML data. As described earlier, this may demonstrate the problem described in this article, depending on the timing of other portions of the Web application.

REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:

Modification Type:MajorLast Reviewed:5/11/2006
Keywords:kbBug kbNavigation kbpending KB269802