0

My content script is not working on certain tab updation event ,I have tried every possible thing but i want to run the script on DOMcontent loaded event in content script by using line of code

    window.addEventListener("DOMFocusIn", function(e) {
    }

or also have used code

  window.addEventListener("DOMContentLoaded", function(e) {
    }

but it is not working. Anybody help please.

mano
  • 85
  • 1
  • 3
  • 17
  • I have a strong feeling mano again refers to dynamically changing DOM (through AJAX) as _"tab updation"_ (as is the case in **[this question](http://stackoverflow.com/questions/20379473/content-script-is-not-working-in-chrome-extension)**). Again, `DOMContentLoading` won't get triggered in the case of dynamic DOM changes, but (as already explained in my answer to the aforementioned question) you should use a `MutationObserver`. – gkalpak Dec 06 '13 at 08:29

1 Answers1

1

I think DOMContentLoaded won't be called again when the page updates. If you want to monitor changes to your content, you might want to use:

$("#someDiv").bind("DOMSubtreeModified", function() {
    alert("tree changed");
});
tpei
  • 671
  • 9
  • 26