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

278
Vistas
JavaScript wait until content loads in iframe and then load another content

I want to create iframe when page is loaded, load content#1 and wait until it loads in the iframe and then load another content#2 the same iframe, then wait some interval and remove iframe.

Also setTimeout functions will be complex and should return some status variables...

Do I do it proper way?

Sorry, I am not good in JavaScript, what happens if loading of content#1 takes more than 25s. i.e. when iframe is removed.

Any pro example/idea? Thanks!

window.onload = function() {

var iframe = document.createElement('iframe');
iframe.id = "iframeid";
iframe.src = 'data:text/html,' + 'content#1';

document.body.appendChild(iframe);

setTimeout(function(){document.body.removeChild(iframe);},25000);
setTimeout(function(){iframe.src = 'data:text/html,' + 'content#2';},5000);

}
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