How can I refresh the parent window when clicking the close button of a child window?
The child window is a pop-up.
You can access the parent window using
window.opener
and refresh the parent window using
window.opener.reload()
See window.opener
To refresh the parent page on close of child window use the following javascript in the popup page and call that using onunload in the popup page.
function refreshParent()
{
window.opener.location.reload(true);
}
<body onunload="javascript:refreshParent()">
<body onunload="window.opener.reload();">
If you use this when you close your child window, the parent will be reloaded. window.opener refers to the parent window object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With