Reputation: 71
I am trying to achieve the following.
How can this (closing a child pop-up and refreshing the parent page) be done in Javascript?
Upvotes: 7
Views: 34970
Reputation: 6299
parent.html
<a href="#" onclick='window.open("child.html","_blank","height=100,width=100,
status=yes,toolbar=no,menubar=no,location=no");return false'>pop up</a>
child.html
<p>child window</p>
<script>
window.onload = function(){
window.opener.location.reload(true);
window.close();
}();
</script>
Upvotes: 3
Reputation: 1514
In the pop-up window:
<script type="text/javascript">
function proceed(){
opener.location.reload(true);
self.close();
}
</script>
<form onsubmit="proceed()">
...
</form>
Upvotes: 11
Reputation: 81482
In the popup's code for closing/reloading:
opener.location.reload();
close();
Upvotes: 5