Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
Detect web page change and notify users about the change

I am trying to detect web page DOM changes, currently using MutationObserver for detecting different changes.

My problem is in uniquely deciding a single change after somethings changes/navigated/updated on the page but MutationObserver fires many event for the change. This leads to send many notification to the user for a single time update on the page.

On twitter, if i navigate to different sections search/profile/home etc. change events are fired many times.

var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
        if (mutation.addedNodes.length > 0) {
            mutation.addedNodes.forEach(function (addednode) {
                    console.log("Added:" + addednode);
            });
        }else if (mutation.removedNodes.length > 0) {
            mutation.removedNodes.forEach(function (removednode) {
                console.log("Removed:" + removednode)
            });
        }
    });
});
    
observer.observe(document.body, {
    characterDataOldValue: true, 
    subtree: true, 
    childList: true, 
    characterData: true
});

How can I effectively decide one change out of many mutation events?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!