
用本地的路径的话,iframe不能高度自适应

用localhost的就可以,为什么?
function reinitIframe() {
var iframe = document.getElementById("pcIframe");
try {
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height;
console.log(iframe.height);
} catch (ex) { }
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
F12调试看看,本地方式打开可能根本就没有加载JS