js实现iframe刷新

今天要用到iframe的框架刷新,在网上找到了关于这方面内容,整理如下:

(1)一般页面的刷新——reload 方法,该方法强迫浏览器刷新当前页面。

       语法:location.reload([bForceGet])

    参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取当前页。true, 则以 GET 方式,从服务端取最新的页面, 相当于客户端点击 F5("刷新")

        window.location.reload();

(2)iframe框架内的页面刷新

   a、方法一:document.getElementById('FrameID').contentWindow.location.reload(true); 
   b、JQuery实现强制刷新:$('#iframe').attr('src', $('#iframe').attr('src'));

(3)刷新打开的新页面:

   a、刷新包含该框架的页面用:parent.location.reload();

   b、子窗口刷新父窗口:self.opener.location.reload();

   c、刷新另一个框架的页面:parent.另一FrameID.location.reload();

 

原文地址:https://www.cnblogs.com/pengjw/p/4288978.html