简体   繁体   English

关闭弹出窗口后自动刷新父窗口

[英]Auto refresh parent window after closing popup

I am having 2 pop up screens in my (Main) jsp. 我的(主)jsp中有2个弹出屏幕。

In the first pop-up the user will update the required information(Update) and after submitting the info, a new pop up will be shown that shows the modifications(View). 在第一个弹出窗口中,用户将更新所需的信息(更新),提交信息后,将显示一个新的弹出窗口,其中显示了修改内容(视图)。

I would like to refresh the Main page when the user clicks on the close "X" in the view page. 当用户在视图页面中单击关闭的“ X”时,我想刷新主页。

I tried to use some scripts like the following in the view page, but it did not work: 我试图在视图页面中使用某些脚本,如下所示,但它不起作用:

<script language="JavaScript">
function refreshParent() {
  window.opener.location.href = window.opener.location.href;

   if (window.opener.progressWindow)

   {
    window.opener.progressWindow.close()
   }
   window.close();
  }
</script>

Try putting this javascript code in your popup window: 尝试将此JavaScript代码放入弹出窗口中:

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

//just call the function 
    ref_and_close();

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

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