简体   繁体   中英

How do i display a page ONLY after the iframe has been loaded completely?

I have a page, index.php, on my application that displays data from another page, weather.php. Unfortunately, the iframe takes a few seconds to load so after the page has loaded fully (i mean the index.php page), the iframe space is there. So what i want to do is to make the page wait for the iframe to load completely before displaying the complete html.How do i go about this?

You can display a spinner until the iframe is loaded.

Below code can be used for checking the iframe loading status and remove the spinner.

var myIframe = document.getElementById('iframeid');
myIframe.addEventListener("load", function() {
    // remove spinner here
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM