Refreshing a parent window when both are modal
This is a tough one that's left me high and dry, because its a unique variation on a more common problem.
I have a modal parent window spawning a modal child window (with a开发者_StackOverflow社区 standard window.showModal
call to open it). The user performs some actions on this new page, and then closes it. On the close, I want to refresh the parent modal window.
What makes this tough is that both are modal. I've seen solutions for how to refresh normally (window.opener.location.refresh(true)
) and if the child is a modal window (window.dialogArguments.location.reload(true);
where the parent window is passed as the 2nd argument).
Any suggestions on what to do? I think the modal nature of the parent is breaking the refresh, and I can't figure out how to work around it.
When you open a Model window with window.showModalDialog the code in the parent page is stoped, so the code after the opening of the modal window won't be executed until the child is closed.
Having said that, just try:
// Open the modal dialog
window.showModalDialog('your/child/url.com')
// after is closed, the parent will refresh it self
window.location.reload();
精彩评论