angular iframe 加载失效解决办法已经自适应高度

<iframe frameborder="0" id="iframe1"></iframe>
$('#iframe1').attr('src', 'www.baidu.com');
document.getElementById("iframe1").contentDocument.location.reload();

 自适应高度:

 var ifm = document.getElementById(iframe);
            ifm.height = 100;
            var subWeb = document.frames ? document.frames[iframe].document : ifm.contentDocument;
            if (ifm != null && subWeb != null) {
                ifm.height = subWeb.body.scrollHeight;
            }

 

posted @ 2019-08-12 16:37  jasonlai2016  阅读(647)  评论(0编辑  收藏  举报