Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

BUG: Internet Explorer May Stop Responding When You Load Nested Element Behaviors


View products that this article applies to.

This article was previously published under Q319738

↑ Back to the top


Symptoms

When you load a page that uses nested element behaviors and then insert a custom element in response to an event, Internet Explorer may stop responding, or hang. The hang may occur if the nested elements also load external script or Extensible Markup Language (XML) data.

↑ Back to the top


Resolution

To work around this problem:
  • For XML data, insert the XML data island in response to an event.
  • For script code, send an Expires header with the script file.
  • For either XML data or script code, place the XML data or the script in-line.

↑ Back to the top


Status

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

↑ Back to the top


More information

Steps to Reproduce the Behavior

There are two ways to cause Internet Explorer to hang:
  • If the cause of the problem is a SCRIPT tag with a src attribute, then you can avoid the problem if you add Hypertext Transfer Protocol (HTTP) headers that make sure that the browser does not request the script file for some predetermined period of time. For example, in Internet Information Server (IIS) you can set the content expiration so that the script file expires at a time in the future, such as in a day. See the "References" section for additional information.
  • Another way to cause Internet Explorer to hang is to send the script file with Expires and Cache-control: max-age HTTP headers.
In this example, the max-age value of 86400 seconds means the file may be kept in a cache for about a day.
Expires: (date)
Cache-control: max-age=86400
				
If the cause of the problem is an XML tag with a src attribute, you can avoid the problem if you modify the HTML Control (HTC) so that the XML data island is inserted dynamically as shown in the following code sample:
testDiv.insertAdjacentHTML("afterEnd", "<xml src=\"Inner.xml\"/>");
				

The following code sample illustrates both causes. You create five files in the following sample. If you use this sample, you must apply both workarounds together.
  1. Create the Sample.htm file:
    <HTML xmlns:ctrl>
    <HEAD>
        <?import namespace="ctrl" implementation="outer.htc">
        <TITLE>Sample Q319738</TITLE>
    </HEAD>
    <BODY>
        <ctrl:outer></ctrl:outer>
    </BODY>
    </HTML>
    
    					
  2. Create the Outer.htc file:
    <html xmlns:ctrl>
    	<?import namespace="ctrl" implementation="inner.htc" />
    <head>
    <public:component tagName="outer">
    	<public:defaults viewLinkContent="true" />
    	<public:attach event=oncontentready onevent="DoElementInsert()" />
    </public:component>
    <script language="JavaScript">
    function DoElementInsert()
    {
    	idDiv.innerHTML = "<ctrl:inner/>";
    }
    </script>
    </head>
    <body style="border: darkgray 2px solid; background-color:lightgrey; padding=5px;">
    	This is the outer element behavior. <br>
    	<div id="idDiv" style="BACKGROUND-COLOR: white">
    		Text in this DIV gets replaced.
    	</div>
    </body>
    </html>
    
    					
  3. Create the Inner.htc file:
    <html>
    	<head>
    		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    		<public:component tagName="inner">
    			<public:defaults viewLinkContent="true" />
    		</public:component>
    		<!-- this script tag will cause a hang if the browser is requesting pages on every visit to the page. -->
    		<script language="javascript" src="inner.js" ></script>
    	</head>
    	<body>
    		<div style="border: 1px solid darkgrey; background-color: lavender; padding: 5px;"
    			id="testDiv">
    			This is the inner element behavior.
    		</div>
    		<!-- This XML tag will cause a hang unless it is inserted dynamically -->
    		<xml src="inner.xml"/>
    	</body>
    </html>
    
    					
  4. Create the Inner.js file:
    	function doNothing() {
    		// Do nothing.
    	}
    
    					
  5. Create the Inner.xml file:
    <?xml version="1.0" encoding="utf-8" ?> 
    <anytag>
    	Any XML will do.
    </anytag>
    					
  6. Save all of these files on an HTTP server.
  7. Start Internet Explorer and explore to the Sample.htm page. For example, explore to http://localhost/Q319738/Sample.htm.
After you complete the preceding steps, you can see the behavior.

If you follow the preceding steps, but you cannot reproduce the behavior, check the following :
  1. Verify that the page is accessed through HTTP protocol (http://). If you access the file from file protocol (file://) you may not be able to reproduce the behavior.
  2. Verify that the caching setting for Internet Explorer is set to Every visit to the page.
    1. To confirm this setting, on the Tools menu, click Internet Options.
    2. From the General tab, click Settings in the Temporary Internet Files panel.
    3. In the Settings dialog box, click to select Every visit to the page in the Check for newer versions of stored pages check box.
  3. Verify that all five files that you created are located in the same virtual directory.

↑ Back to the top


References

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
313561� HOW TO: Set HTTP Headers for Content Expiration in Internet Information Services (IIS) 5.0
For information about the HTTP Protocol standard and the meaning and the proper values of HTTP headers, visit the following Web site:
Hypertext Transfer Protocol -- HTTP/1.1
http://www.w3.org/Protocols/rfc2616/rfc2616.html

↑ Back to the top


Keywords: KB319738, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 319738
Revision : 2
Created on : 5/10/2003
Published on : 5/10/2003
Exists online : False
Views : 416