roosevelt Posted August 6, 2009 Share Posted August 6, 2009 Hello, I am working on a FF Extension, and need to execute a function after a web page is fully/completely loaded. On my .js file I have the following codes, and it works but buggy! window.addEventListener("load", function() { myExtension.init(); }, false); var myExtension = { init: function() { var appcontent = document.getElementById("appcontent"); // browser if(appcontent) appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true); }, onPageLoad: function(aEvent) { $mb = jQuery.noConflict(); doc = window.content.document; $mb(doc).ready(function() { //Do Stuff }); } } The problem is, the function I want to execute on the Do Stuff section actually keeps executing while the page is still not fully loaded. Is there any event that basically flags that everything completely loaded (DOM, images, whatever), and I can execute my desired actions? Link to comment Share on other sites More sharing options...
Question
roosevelt
Hello,
I am working on a FF Extension, and need to execute a function after a web page is fully/completely loaded.
On my .js file I have the following codes, and it works but buggy!
window.addEventListener("load", function() { myExtension.init(); }, false); var myExtension = { init: function() { var appcontent = document.getElementById("appcontent"); // browser if(appcontent) appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true); }, onPageLoad: function(aEvent) { $mb = jQuery.noConflict(); doc = window.content.document; $mb(doc).ready(function() { //Do Stuff }); } }The problem is, the function I want to execute on the Do Stuff section actually keeps executing while the page is still not fully loaded.
Is there any event that basically flags that everything completely loaded (DOM, images, whatever), and I can execute my desired actions?
Link to comment
Share on other sites
0 answers to this question
Recommended Posts