The platform I am working on needs to dynamically load Javascript files that embed a flash video into a specified div. We shall call the div id “target”. The Javascript file is appended into the div properly. However the flash video contents do not load. How can I ensure that the embed scripts execute after the document has been loaded?
var div = document.getElementById("target");
var newScript = document.createElement("script");
newScript.setAttribute("type","text/javascript");
newScript.setAttribute("src","http://www.go.url");
div.appendChild(newScript);
Listen for the load event from the document then load your script: