After several attempts I found a solution for this. Lets say we have a function
called pageLoaded
, which is the one we want to call when the website has been totally loaded. Now, we have to add an event listener to the gBrowser
object to catch the load
event.
Here the code:
function pageLoaded(){
alert("the page has been loaded")
}
gBrowser.addEventListener("load", pageLoaded, true);
I recommend to use add an event listener to the extension document before to add it to the gBrowser. The result would be something like this:
window.addEventListener("load", function () {
gBrowser.addEventListener("load", pageLoaded, true);
}, false);
I hope this solution will be useful for someone.
Thanks for reading.