Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda