PRB: OnReadyStateChange and OnLoad Events Not Fired for an IFrame (239638)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • Microsoft Internet Explorer (Programming) 4.01 SP1
  • Microsoft Internet Explorer (Programming) 4.01 SP2
  • Microsoft Internet Explorer (Programming) 5

This article was previously published under Q239638

SYMPTOMS

Documentation mentions that OnReadyStateChange and OnLoad events fire for IFRAME. But the event handler for these events never gets called. This article specifically discusses IFRAME but the information is applicable for FRAME and FRAMESET as well.

CAUSE

These events are fired in the context of the document object model of the IFRAME and not in the parent's object model. By the time the IFRAME is loaded, the above events are already fired and ReadyState is complete. You cannot rely on the above property to test whether an IFRAME is loaded.

STATUS

This behavior is by design in the versions of Internet Explorer listed at the beginning of the article.

MORE INFORMATION

There is no good way to find out if an IFRAME is loaded from its parent.

The best workaround might be to have the IFRAME access the parent once it is loaded instead of the parent trying to access the IFRAME.

The browser could also try accessing the IFRAME using try-catch error handling of JavaScript with a timer if the Microsoft Scripting Engines Version 5.0 is installed.

REFERENCES

Microsoft Windows Scripting Technologies

For additional information, please click the article number below to view the article in the Microsoft Knowledge Base:

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


Modification Type:MajorLast Reviewed:7/20/2001
Keywords:kbDHTML kbDSupport kbFAQ kbprb KB239638