Article ID: 188763 - Last Review: May 11, 2006 - Revision: 2.0

PRB: document.readyState Not in Sync with Download in IFrame

This article was previously published under Q188763

On This Page

Expand all | Collapse all

SYMPTOMS

When you insert an IFrame using insertAdjacentHTML, the readyState is not in sync with the download of the document in the new IFrame. If you check the value of document.readyState immediately after the insertAdjacentHTML, the readyState is set to complete, even though the document in the IFrame has not finished loading.

STATUS

The behavior is by design. Once a document goes readystate complete, Internet Explorer does not fire onreadystatechange again.

MORE INFORMATION

Steps to Reproduce Behavior

Here is HTML code that reproduces the problem. When you press the button, an IFrame is inserted before the end of the body. Then, a message box is displayed to show the value of document.readyState. At this point, document.readyState is set to complete. The readyState should change as the document in the IFrame is downloaded.
<HTML>
<HEAD>
   <TITLE>IFrame/readyState Bug</TITLE>

   <SCRIPT LANGUAGE="VBScript">
   Sub btn_onClick
      document.body.insertAdjacentHTML "BeforeEnd", _
         "<IFRAME SRC='http://www.microsoft.com'></IFRAME>"

      MsgBox "ReadyState: " + document.readyState
   End Sub
  </SCRIPT>
</HEAD>
<BODY>
   <BUTTON ID="btn">Insert IFrame</BUTTON>
</BODY>
</HTML>
				

REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/)

http://support.microsoft.com/iep (http://support.microsoft.com/iep)

APPLIES TO
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 5.0
Keywords: 
kbpending kbprb KB188763
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
 

Article Translations

 

Related Support Centers