Attach a listener to an AJAX event via the chrome extension

I want to connect a listener to an AJAX update so that I can reload the chrome extension. Right now, if the user clicks and goes to another section of the site that is downloaded via AJAX, the extension is not displayed. This site is not my site, so I do not control the AJAX update. Thank!

+5
source share
1 answer

You cannot listen to ajax requests (without using the experimental api), but you can listen to the event DOMSubtreeModifiedthat fires when the DOM changes:

document.addEventListener("DOMSubtreeModified", function(event){
        //something on the page has changed
});

, , , . , .

+4

All Articles