Microsoft KB Archive/320731

= The Internet Explorer progress bar continues to increase when an attached behavior is dynamically inserted in a page =

Article ID: 320731

Article Last Modified on 5/21/2007

-

APPLIES TO


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

-



This article was previously published under Q320731



SYMPTOMS
When you dynamically add an object that contains an attached behavior to a Web page, and the behavior must be downloaded, the progress bar in Microsoft Internet Explorer continues to increase. The progress bar continues to show progress even after the behavior is downloaded, and the page is rendered. However, the attached behavior works correctly without any unexpected problems.



CAUSE
This issue may occur when Every visit to the page is selected for the Check for newer versions of stored pages option in Internet Explorer.

To view the Check for newer versions of stored pages option, follow these steps:
 * 1) In Internet Explorer, click Tools, and then click Internet Options.
 * 2) On the General tab, click Settings under Temporary Internet files.
 * 3) In the Settings dialog box, view the Check for newer versions of stored pages option.



WORKAROUND
To work around this issue, take the following actions:
 * Avoid dynamically inserting any objects that contain attached behaviors.
 * Set the message text in the status bar of Internet Explorer after you add the object.



MORE INFORMATION
This issue occurs if you dynamically add an attached behavior by replacing the inner HTML of an element, such as the DIV element, by using the createElement method or the insertAdjacentHTML method, or by dynamically changing the className property of an element.

Steps to reproduce the behavior
  Copy the following code sample, and then save the code sample to a file that is named Test.htm.    .UseBehavior {               behavior: url(behavior.htc); }       

 function DoClick {               SetTarget.innerHTML = &quot;Hello World&quot;; //Uncomment the following line to work around the problem. //window.status=&quot;Finished&quot;; }        

<BODY> <DIV ID=&quot;SetTarget&quot;>Click to try the test</DIV><BR> <BUTTON onClick=&quot;DoClick&quot;>Click to insert the attached behavior.</BUTTON> </BODY> </HTML> </li> <li> Copy the following code sample, and then save the code sample to a file that is named Behavior.htc. Put the Behavior.htc file in the same directory where the Test.htm file is located. <PUBLIC:COMPONENT> <PUBLIC:ATTACH EVENT=&quot;ondocumentready&quot; ONEVENT=&quot;Element_DocumentReady&quot; />

<SCRIPT language=&quot;JScript&quot;> function Element_DocumentReady {   // This is almost an empty behavior. } </SCRIPT> </PUBLIC:COMPONENT> </li> <li>Open the Test.htm file, and then click Click to insert attached behavior.</li></ol>

After the text changes from &quot;Click to try the test&quot; to &quot;Hello World&quot;, the behavior is added. The progress bar loads indefinitely.

<div class="references_section">