Microsoft KB Archive/239638

= PRB: OnReadyStateChange and OnLoad Events Not Fired for an IFrame =

Article ID: 239638

Article Last Modified on 7/20/2001

-

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 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0

-



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.

