Search code examples
javascriptgoogle-chrome-extension

Is there a way to detect user's actions on a webpage for Chrome Extension


I want to trigger some event on my extension whenever

  • the website page is loaded
  • user navigates on the same page by clicking some links

The first, I can accomplish with:

chrome.tabs.onUpdated.addListener(...)

But it does not trigger when the user click something to navigate through the page. (it's a single-page application)


Solution

  • You should use click listeners or MutationObservers in your content script.

    https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe