history.go(-1)没有加载我的其他函数

history.go(-1) not loading my other function

本文关键字:加载 我的 其他 函数 go history      更新时间:2023-09-26

我的页面上有resizeIframe函数,然后在单击下一个之后,iframe会以更大的高度调整大小,但当我使用history.go返回时,我的iframe仍然处于更大的高度。为什么函数resizeiframe没有再次加载?

这是用于调整iframe:大小的代码

function resizeIframe()
{
  {
document.getElementById('content').style.height = 70;
    }
    ;
    {
      document.getElementById('content').style.height = document.getElementById('content').contentWindow.document.body.scrollHeight + 'px';
    }

}

它是在iframe onload上调用的。

您可以使用document.referrer返回页面刷新

window.location.href = document.referrer;
// For IE
if(IE){ //IE, bool var, has to be defined
    var newlocation = document.createElement('a');
    newlocation.href = URLtoCall;
    document.body.appendChild(newlocation);
    newlocation.click();
}