判断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

posted @ 2016-12-26 16:06  Amy-WebFrontEnd  阅读(798)  评论(0编辑  收藏  举报