Reload parent page after closing popup window

后端 未结 2 892
南方客
南方客 2021-01-15 15:09

I am trying to have the user sign in through a popup window. When they click the link to the popup window which is a php variable they can sign in. When the window closes

2条回答
  •  清酒与你
    2021-01-15 15:44

    To reload a page, you can set the location property as the current value, like this:

    window.location = window.location;
    

    So for your case, you would use, literally:

    onunload="window.opener.location = window.opener.location;"
    

    You can also use the reload method of the location object:

    onunload="window.opener.location.reload();"
    

    This is the preferred method.

    Also, please refer to the accepted answer for your previous question: Refreshing Parent window after closing popup

    Documentation

    • window.location on MDN - https://developer.mozilla.org/en/DOM/window.location
    • window.opener on MDN - https://developer.mozilla.org/Talk:en/DOM/window.opener

提交回复
热议问题