Reputation: 425
If I inject html (iframe containing a video) through javascript is there an event/function that can be used to see if the injected HTML is finished loading?
I tried including javascript at the bottom of the injected content but that is not being executed.
Also I do not plan on using jquery.
Upvotes: 2
Views: 630
Reputation: 83366
After you inject the html, you could subscribe to the iframe's onload event:
document.getElementById("iframeId").onload = function(){
alert("Loaded!");
};
Upvotes: 1
Reputation: 114417
If the content is from another domain, all you can capture is the onload
event for the iframe
itself. That doesn't tell you the content has rendered, just that it has loaded.
Upvotes: 1