Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
Android WebView : MutationObserver doesn't detect IFRAME being added to html document

I'm writing an app the contains a WebView in which I display pages from different websites. Some of these pages contain IFrames.

My app injects javascript into the displayed WebView and my problem is that my MutationObserver code seems to miss the addition of new Iframes in the DOM.

My code is pretty generic, taken from from detect-load-of-iframe-not-same-domain-dynamically-added-in-javascript-or-jque (which reportedly works):

var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
        [].filter.call(mutation.addedNodes, function (node) {
            return node.nodeName == 'IFRAME';
        }).forEach(function (node) {
            node.addEventListener('load', function (e) {
                console.log('loaded', node.src);
            });
        });
    });
});
observer.observe(document, { childList: true, subtree: true });

I'm not interested in what's going inside the Iframe , so cross-origin content is of no concern here. I'm only interested in retrieving the Iframe's 'src' attribute.

Any ideas on how to intercept the Iframe's creation?

Edit : I cannot load additional javascript files, I need to use only native javascript code for this.

thanks

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda