JSFiddle - React, Tailwind, and code Playground
HTML
<iframe src="https://ipaymobile.000webhostapp.com">
</iframe>
JavaScript
var iframe = window.frames[0];
iframe.document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM completamente carregado e analisado");
// cria uma nova instância de observador
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
function verificavar() {
var numeros = iframe.document.getElementById("contador").innerHTML;
if(!numeros) {
//The node we need does not exist yet.
//Wait 500ms and try again
window.setTimeout(verificavar,500);
return;
}
// configuração do observador:
var config = {
attributes: true, childList: true, characterData: true
};
// passar o nó alvo, bem como as opções de observação
observer.observe(numeros, config);
}
verificavar();
});