EDIT : since this problem is now “resolved” to the working point, I am looking for information on why. For correction see my comment below.
I have a web application that dynamically loads wav files dynamically (after a timeout or as directed by a user) in an iframe to start the default player to play them. The application is only for FF 2 or 3. To determine when the file is fully loaded, I hope to use the window.onload handler for the iframe. Based on https://stackoverflow.com/a/4129605/2128323 I create a new iframe every time. As long as firebug is enabled in the browser using the application, everything works fine. Without firebug, onload never works. The firebug version is 1.3.1, while I tested Firefox 2.0.0.19 and 3.0.7. Any ideas how I can get onload from iframe to run reliably when loading a wav file? Or is there another way to report a download is complete? Here is the relevant code:
HTML (only the hidden attribute is display: none;):
<div id="audioContainer" class="hidden">
</div>
JavaScript (you can also use jQuery, but innerHTML is faster than html () from what I read):
waitingForFile = true;
$("#loading").removeClass("hidden");
var content = "<iframe id='audioPlayer' name='audioPlayer' src='" +
/path/to/file.wav + "' onload='notifyLoaded()'></iframe>";
document.getElementById("audioContainer").innerHTML = content;
And the contents of notifyLoaded:
function notifyLoaded() {
waitingForFile = false;
$("#loading").addClass("hidden");
}
I also tried to create an iframe through document.createElement, but I found the same behavior. Onload starts every time firebug is on and never without it.
EDIT:
Fixed information on how an iframe is declared, and added callback function code. No, there is no console.log.
source
share