Load event for iFrame not fired in IE

前端 未结 7 1503
无人及你
无人及你 2020-12-09 02:46

Why is the load event not fired in IE for iFrames?

Please take a look at this example.

Work perfectly as expected in FF and Chrome, but IE fails

7条回答
  •  伪装坚强ぢ
    2020-12-09 03:25

    IE might have already loaded the content (and fired the event) before you add the handler. I found that when I statically specified the iframe src attr, and added $(x).load event handlers via jquery, firefox (3.6.28) triggered my handlers but IE (8.0.6001.18702) didn't.

    I ended up adjusting my test program so that it set the iframe src via javascript after adding the $(x).load handler. My $(x).load handler was called at the same points in IE and Firefox (but note a handler added via iframe onload attribute behaved differently between IE and FF) . Here is what I ended up with:

    
    
    
    
    
    
    
    
    
    
    
    
    
    

    ... and here was the Firefox "log":

    i1/eb_mce_iframe_content.html actually loaded i1:

    Fred the fox.

    /eb_mce_iframe_content.html actually loaded x:

    Fred the fox.

提交回复
热议问题