Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10736 closed bug (invalid)

iframe load event

Reported by: Math. Owned by:
Priority: low Milestone: None
Component: event Version:
Keywords: Cc:
Blocked by: Blocking:

Description

jQuery does not handle load event for iframe which are not yet added to the document as you can do with img.

Test case: http://jsfiddle.net/5KK7w/

Works: $('body').append('<iframe id="iframe1"/>'); $('#iframe1').load(function(){

alert('iframe loaded');

}).attr({'src':srcIframe});

Does not work: $('<iframe id="iframe1"/>').load(function(){

alert('iframe loaded'); $(this).appendTo('body');

}).attr({'src':srcIframe});

Change History (3)

comment:1 Changed 7 years ago by timmywil

Component: unfiledevent
Priority: undecidedlow
Resolution: invalid
Status: newclosed

If you watch the network traffic, you can see that the iframe src is not retrieved until the iframe is appended to the body. Therefore, it has not yet loaded as an image would.

comment:2 Changed 7 years ago by Math.

That's right and jQuery should handle this.

comment:3 Changed 7 years ago by timmywil

That's not something we can control. It has not loaded yet.

Note: See TracTickets for help on using tickets.