2

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.

2 Answers 2

1

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.

1
  • same domain - took awhile but we fixed that problem
    – mbuff24
    Jan 17, 2012 at 22:30
1

After you inject the html, you could subscribe to the iframe's onload event:

document.getElementById("iframeId").onload = function(){
    alert("Loaded!");
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.