My goal is to run a content script on a specific website (like injecting a button or changing a link), but I want this to happen while the user is browsing the site.
The issue is that the webpage is dynamically constructed with ajax requests as the user navigates through it.
In a previous extension I developed, I addressed this by directly injecting my JavaScript code into the webpage itself.
I'm now exploring if there's a more efficient method, like being able to listen for an ajaxComplete event in my content script and then re-executing it when needed.
I've tried using the following approach:
function listener()
{
console.debug("listener fired.");
}
document.addEventListener("DOMSubtreeModified", listener, false);
Unfortunately, this method triggers too frequently during a single page load.