Closed Bug 230572 Opened 22 years ago Closed 22 years ago

Unable to detect loading complete status of dynamically added script

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: gerbert, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827 I can find now way of detecting loading complete status of dynamically added script. <html><head><script> function go(){ document.body.innerHTML = '<script src="somefile.js"></'+'script>'; var aScripts = document.body.getElementsByTagName('SCRIPT'); alert(aScripts[0].src); // ok. now we have the script .. but when is it done loading? } </script></head> <body onload="go();"></body> </html> Since I have no control over the scripts included, it is no option to include some callback in the included scripts. Is this feature supposed to be missing? coz in IE one can just do a document.scripts[0].readyState check. Thnx, Gerbert Reproducible: Always Steps to Reproduce: 1. I have provided code to show the required mechanism 2. 3.
I forgot to add that the scripts themselves might do a document.body.innerHTML += '<script language="JavaScript" src="another_dynamic_script.js"></'+'script>'; or anything like that. I have to wait untill all scripts are loaded before I can continue. This is sortof a delayed body.onload for dynamic scripts G.
If you set the onload handler on the <script> node it will fire when the script is loaded.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.