用本地的路径的话,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) { }
}
F12调试看看,本地方式打开可能根本就没有加载JS