Question: I opened a popup window by window.open in JavaScript, I want to refresh parent page when I close this popup window.(onclose event?) how can I do that?

```
window.open("foo.html","windowName", "width=200,height=200,scrollbars=no");

```

Answer: 
I use this: 

```
<script language='javascript'>
var t;
function doLoad() {
t = setTimeout("window.close()",1000);
}

</script>
<script type="text/javascript">
function refreshAndClose() {
    window.opener.location.reload(true);
    window.close();
}
</script>
<body onbeforeunload="refreshAndClose();" onLoad='doLoad()''>

```

when the window closes it then refreshes the parent window.
If your app runs on an HTML5 enabled browser. You can use [postMessage](https://developer.mozilla.org/en/DOM/window.postMessage). The example given there is quite similar to yours.