Problem: After closing modal window, parent window is not reloading
Root Cause: Code
Solution:
I was using "SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK); " to close the modal window.
My Code is:
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);
window.onbeforeunload = RefreshParent;
RefreshParent=function () {alert('hi');
if (window.opener != null && !window.opener.closed) {
window.opener.location.reload();
}
I am calling "RefreshParent" after SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK), which is not correct.
I changed my code like this..
window.onbeforeunload = RefreshParent;
RefreshParent=function () {alert('hi');
if (window.opener != null && !window.opener.closed) {
window.opener.location.reload();
}
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);
Now Parent window is reloading.
Root Cause: Code
Solution:
I was using "SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK); " to close the modal window.
My Code is:
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);
window.onbeforeunload = RefreshParent;
RefreshParent=function () {alert('hi');
if (window.opener != null && !window.opener.closed) {
window.opener.location.reload();
}
I am calling "RefreshParent" after SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK), which is not correct.
I changed my code like this..
window.onbeforeunload = RefreshParent;
RefreshParent=function () {alert('hi');
if (window.opener != null && !window.opener.closed) {
window.opener.location.reload();
}
SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK);
Now Parent window is reloading.