Answer the question
In order to leave comments, you need to log in
How to run an addon in firefox before the page is loaded?
I need to write an add-on that fires as soon as possible before the page loads. To do this, I registered in the manifest "run_at": "document_start"
. In a js file, I create an interval and try to catch it at the moment, in chrome it works instantly, and in firefox after a while. How can this be fixed?
let div3 = document.createElement("div");
div3.style.position = "absolute";
div3.style.width = "50%";
div3.style.height = "50vh";
div3.style.top = "50%";
div3.style.left = "50%"
div3.style.backgroundColor = "green";
div3.style.zIndex = "100";
let all = setInterval( () => {
try {
document.querySelector('body').appendChild(div3);
} catch (err) {}
}, 1);
setTimeout(() => { clearInterval(all);}, 1000);
// @run-at document-start
. But the result is the same, in Google everything is fine in FF with a delay.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question