I want to attach a listener to a AJAX update, so that I can reload my chrome extension. Right now if a user clicks and goes to another section of the site that is loaded via AJAX the extension doesn't show up. This site is not my site, so I don't control the AJAX updating. Thanks!
You can't listen to ajax requests (without using experimental api), but you can listen to DOMSubtreeModified
event that fires whenever DOM is modified:
document.addEventListener("DOMSubtreeModified", function(event){
//something on the page has changed
});
Just need to be careful as there might be hundreds of such events firing in seconds when big chunk of page is modified. Might need to implement some delay.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With