Q:

Closing a popup window in servlet and refreshing parent window

I am creating a web app using servlet which uses Facebook for authentication. So whenever user press log in button i open a new popup window where user enter Facebook log in credentials and then its redirected to a servlet. In servlet i extract the information of user logged in and create a session. After creating the session i want this popup to be closed and parent window should be refreshed to another location. To open popup i use the following script
function popitup(url) {
    newwindow=window.open(url,'name','height=200,width=150');
    if (window.focus) {newwindow.focus()}
return false;
}

I want to imitate same kind of mechanism which Facebook like box uses when you click like and you are not logged in.

A:

After the job is done in the popup window you should call refreshParent()
<script language="JavaScript">

function refreshParent() {
  window.opener.location.href = window.opener.location.href;
  window.close();
}

</script>

This will do the refreshing of parent plus the closing of the popup.
Dont forget that this code should be in you popup window and called only after all job is done in the popup

