How to find if web page got appended using chrome extension

I am new to chrome extension and I am trying to find whether page content got appended.

For E.g. in Facebook, we can see the content will appended automatically when the user scroll down the page.

I have the following code in background.js

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {

   alert("page is appending....");

});

The above code is expected to fire when the page got updated. But, I am seeing that it is getting called only for few times. Not always.

Or Am I making any mistake here ?

My requirement is, whenever the web page appended in facebook, I have to do get the page content and obtain few string from the same.

Thanks in advance.

Answers


Your onUpdated event is in the chrome.tabs namespace on purpose, it listens the updates of tab's general attributes like: the tab pinned, the favicon changed, the URL changed, see the documentation (also check the update() method). So this way is not workable. Instead listen the DOM tree change with DOMSubtreeModified event or MutationObserver.


Need Your Help

The model item passed into the dictionary is of type 'x', but this dictionary requires a model item of type 'x'

c# asp.net-mvc

I have added a drop down list to match the school contact to the school when creating a new exam for a student of that school. The problem is when I try to post I get the error.

Linking to a shared library that links to another shared library segfaults on exit

c++ cmake

Unfortunately I have been unable to create a minimal example, but here is the situation. I have one library that links to another, like this: