获取iframe高度
作者:
royluck | 来源:发表于
2020-04-14 15:41 被阅读0次// iframe已加载完毕
if (iframe.attachEvent) {
iframe.attachEvent('onload', function () {
let offsetHeight = document.getElementById('iframe').contentWindow.document.documentElement.offsetHeight;
that.iframeHeight = offsetHeight;
})
} else {
iframe.onload = function () {
// iframe加载完毕以后执行操作
let offsetHeight = document.getElementById('iframe').contentWindow.document.documentElement.offsetHeight;
that.iframeHeight = offsetHeight;
}
}
注意这里会出现跨域问题
本文标题:获取iframe高度
本文链接:https://www.haomeiwen.com/subject/zrrtvhtx.html
网友评论