history.go(-1)没有加载我的其他功能

时间:2015-02-07 15:43:09

标签: javascript html

我在我的页面上有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上调用它。

1 个答案:

答案 0 :(得分:0)

您可以使用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();
}