简体   繁体   English

使用JavaScript从具有多个父窗口的子窗口刷新父窗口

[英]Refresh parent window from child with multiple parent window using javascript

I have tree window (first-> second -> third). 我有树形窗口(第一->第二->第三)。 I want to reload second by closing third one. 我想通过关闭第三个来重新加载第二个。 But after closing third one the first one getting refresh. 但是在关闭第三个之后,第一个开始刷新。 I had written following script. 我写了以下脚本。

window.onunload = refreshParent;
self.close(); 
function refreshParent() {
     window.opener.location.reload();
}       

Apply this script in third window's html file and see if it works. 在第三个窗口的html文件中应用此脚本,然后查看它是否有效。 Also, make sure you give an unique name for all the windows. 另外,请确保为所有窗口指定唯一的名称。

<script>
    window.onunload = closeMeAndRefreshOpener;
    function closeMeAndRefreshOpener() {
        window.opener.location.reload();
        self.close();
    }
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM