tags:

views:

251

answers:

3

I have a pop-up window a user logs into, once they are logged in successful, I have a message that has a link to close the window. But I want it to not only close that pop up window, but I want it to refresh the webpage the pop-up window was clicked on.

So the page can refresh to see that there is a valid login session for that user.

Is this possible w/ jQuery?

+2  A: 

You can do this:

window.location.reload()

It just tells javascript to reload the page, this is not dependent on jQuery.

Nick Craver
+3  A: 

In your popup window:

$('#closeButton').click(function(e) {
    window.opener.location.reload(true);
    window.close();
    e.preventDefault();
});

Reloads the parent page and closes the popup.

Jan Jongboom
Returning `false` from a handler is equivalent to calling both `.preventDefault()` and `.stopPropagation()` on the event object.
Andy
A: 

Here is a code that refresh parent window and closes the popup in one operation.

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

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