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

208
Views
Iframe observer not working, how to use MutationObservers

Im trying to make a mutationObserver that calls a callback function whenever this iframe subtree is modified (a element is added or remove, ex.: a <p> element). However, i cannot get this to work. I dont know what im doing wrong. I only got it to work without using the inline function (and using the function example(){} model), but it fires once when the page loads and then it never fires again.

<div id="main_content_container" name="main_content_container">
            <!-- Resposta das buscas -->
            <iframe name="dummyframe" id="dummyframe" style="display: none;">
            </iframe>
            <script>
                const myframe = document.getElementById("dummyframe").contentWindow.document.body;
                const config = {attributes:true,childList:true,subtree:true};
                var observer = new MutationObserver((mutation) => {
                    console.log("modified");
                });
                observer.observe(myframe,config);
            </script>
        </div>

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!