Skip to main content

Bug Tracker

Side navigation

#10736 closed bug (invalid)

Opened November 09, 2011 05:42PM UTC

Closed November 09, 2011 07:01PM UTC

Last modified March 14, 2012 10:46AM UTC

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});

Attachments (0)
Change History (3)

Changed November 09, 2011 07:01PM UTC by timmywil comment:1

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.

Changed November 09, 2011 07:34PM UTC by Math. comment:2

That's right and jQuery should handle this.

Changed November 09, 2011 07:43PM UTC by timmywil comment:3

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