To open popup and refresh the parent page on close popup with JavaScript, we use the window.opener
property to access the parent window.
For instance, we write
const refreshParent = () => {
window.opener.location.reload();
};
window.onunload = refreshParent;
to set the window.onunload
property to the refreshParent
function.
In it, we get the parent window with window.opener
.
And we call its location.reload
method to reload it.