11

If I do an online onload event for embedded objects, that seems to work but I can't seem to get the load event working through addEventListener. Is this expected?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Geuis
  • 41,122
  • 56
  • 157
  • 219

5 Answers5

3

Probably, but it may be browser dependent.

windows and images and iframes define their load events with addEventListener and attachEvent, but other load events are browser specific.

A script or link element's onload doesn't attach in IE, for instance.

kennebec
  • 102,654
  • 32
  • 106
  • 127
0

try

$("embed").ready(function(){ ... });

Fatih Koca
  • 147
  • 1
  • 5
-1

could always set like this:

document.getElementById("objectId").onload = function(){ ... }
BenMorel
  • 34,448
  • 50
  • 182
  • 322
Samuel
  • 16,923
  • 6
  • 62
  • 75
-2

jQuery on/bind/load won't be fired for embed elements, while ready works but not after rendered when using Chrome, if you want to listen to the stage after rendering embeded elements, you may have to use pure js to add handlers.

PuiMan Cheui
  • 94
  • 1
  • 9
-2

jQuery is perhaps the best way to go with this.

$("embed").load(function(){
   // enter code here
})
jackyalcine
  • 469
  • 1
  • 8
  • 21