maas
maas

Reputation: 401

Auto refresh parent window after closing popup

I am having 2 pop up screens in my (Main) jsp.

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.

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>

Upvotes: 2

Views: 14990

Answers (2)

Dee_wab
Dee_wab

Reputation: 1165

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

//just call the function 
    ref_and_close();

Upvotes: 1

Sarfraz
Sarfraz

Reputation: 382861

Try putting this javascript code in your popup window:

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

Upvotes: 15

Related Questions