I need a event that works in a contenscript (loadet by manifest) and is firing by loaded complet html-pages. After loadet ther is somthing to do in the page.
onActivated and onUpdate works but I think it dont work by XMLHttpRequest in Page.
I try many thinks, but with no result.
So this follow not work in contenscript:
document.addEventListener(“DOMContentLoaded”, function(event) {
console.log(“5. DOM fully loaded and parsed”);
});
window.addEventListener(“loadend”, loadEnd);
XHR does not trigger a content script. It loads a file and fires events on its instance. After that the raw file is available to you. The HTML is not parsed into DOM and no JS is ran on it. Only tabs and iframes run pages and trigger content scripts.
I want in every times a page changed with my extension content highlighting something in the new content. In all other cases (onActiveded, onUpdate pages) it work
If you don’t have any better event like the page pushing a new URL or similar, you can always fall back to using a mutation observer, checking for changes in the DOM.
checking for changes in the DOM. Its not working on cs. I don’t know why.
window.addEventListener(“click”, ()=>{console.log(“click”);}); run, but not helpfull
all other are not running:
window.addEventListener(“DOMContentLoaded”, function(event) { });
window.addEventListener(“loadend”, loadEnd);
window.addEventListener(‘DOMContentLoaded’, handler);
window.addEventListener('load', function( ) {
console.info('4. Document has finished loading');
});