Microsoft KB Archive/319738

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

Article ID: 319738

Article Last Modified on 5/10/2003

-

APPLIES TO


 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Explorer (Programming) 5.5 SP2
 * Microsoft Internet Explorer (Programming) 6.0

-



This article was previously published under Q319738



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.



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.



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



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 &quot;References&quot; 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(&quot;afterEnd&quot;, &quot;&quot;);

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.   Create the Sample.htm file:   <?import namespace=&quot;ctrl&quot; implementation=&quot;outer.htc&quot;> Sample Q319738    </BODY> </HTML>

</li> <li> Create the Outer.htc file: <html xmlns:ctrl> <?import namespace=&quot;ctrl&quot; implementation=&quot;inner.htc&quot; /> <public:component tagName=&quot;outer&quot;> <public:defaults viewLinkContent=&quot;true&quot; /> <public:attach event=oncontentready onevent=&quot;DoElementInsert&quot; /> </public:component> <script language=&quot;JavaScript&quot;> function DoElementInsert {   idDiv.innerHTML = &quot;<ctrl:inner/>&quot;; } <body style=&quot;border: darkgray 2px solid; background-color:lightgrey; padding=5px;&quot;> This is the outer element behavior. <div id=&quot;idDiv&quot; style=&quot;BACKGROUND-COLOR: white&quot;> Text in this DIV gets replaced.

</li> <li> Create the Inner.htc file: <meta name=&quot;vs_targetSchema&quot; content=&quot;http://schemas.microsoft.com/intellisense/ie5&quot;> <public:component tagName=&quot;inner&quot;> <public:defaults viewLinkContent=&quot;true&quot; /> </public:component> <script language=&quot;javascript&quot; src=&quot;inner.js&quot; > <div style=&quot;border: 1px solid darkgrey; background-color: lavender; padding: 5px;&quot; id=&quot;testDiv&quot;> This is the inner element behavior. <xml src=&quot;inner.xml&quot;/>

</li> <li> Create the Inner.js file: function doNothing { // Do nothing. }

</li> <li> Create the Inner.xml file: <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> Any XML will do. </li> <li>Save all of these files on an HTTP server.</li> <li>Start Internet Explorer and explore to the Sample.htm page. For example, explore to http://localhost/Q319738/Sample.htm.</li></ol>

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 : <ol> <li>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.</li> <li>Verify that the caching setting for Internet Explorer is set to Every visit to the page. <ol style="list-style-type: lower-alpha;"> <li>To confirm this setting, on the Tools menu, click Internet Options.</li> <li>From the General tab, click Settings in the Temporary Internet Files panel.</li> <li>In the Settings dialog box, click to select Every visit to the page in the Check for newer versions of stored pages check box.</li></ol> </li> <li>Verify that all five files that you created are located in the same virtual directory.</li></ol>

<div class="references_section">