After numerous trials, I finally discovered a workaround for this issue. Let's assume we have a function
named pageLoaded
, which is the one we wish to execute once the website is completely loaded. To achieve this, we need to attach an event listener to the gBrowser
object in order to capture the load
event.
Below is the code snippet:
function pageLoaded(){
alert("the page has been loaded")
}
gBrowser.addEventListener("load", pageLoaded, true);
I suggest adding an event listener to the extension document first before attaching it to gBrowser. The final result should look something like this:
window.addEventListener("load", function () {
gBrowser.addEventListener("load", pageLoaded, true);
}, false);
I hope this solution proves to be helpful for someone facing a similar challenge.
Thank you for taking the time to read this.