Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!