Refresh parent window when the pop-up window is closed

后端 未结 4 1872
梦如初夏
梦如初夏 2020-12-14 12:31

Is there any way I can refresh the parent window when a popup window is closed without adding any javascript code to the popup window?

I have a page parent.php on wh

4条回答
  •  一向
    一向 (楼主)
    2020-12-14 12:55

    had similar problem to detect the closing popup in the parent window. I think the reason was in not setting the document.domain property.

    any way add to Tim Down answer the document.domain property for both window and popup like this:

         
    

    and instead of

     window.onunload = function() {
         if (window.opener && !window.opener.closed) {
            window.opener.popUpClosed();
         }
     };
    

    I used in the popup :

         
    

提交回复
热议问题