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>