判断iframe加载完成

一、js判断

       var parFrame = document.getElementById("oIframe");
        if(parFrame.attachEvent){
            parFrame.attachEvent('onload',function(){
                console.log('ie');//IE,不包含edge
            })
        }else{
            parFrame.onload = function(){
                console.log("iframe加载完成");
            }
        }

二、jquery判断

       $("#oIframe").load(function(){
            console.log("iframe加载完成");
        });

父页面:

<div id="parent">
        <iframe name="oIframe" id="oIframe" src="iframe.html" frameborder="0" width="1000" height="562"></iframe>
</div>

参考链接:http://blog.csdn.net/qiqingjin/article/details/50487013

原文地址:https://www.cnblogs.com/loveamyforever/p/6222684.html