I have looked for awhile and cannot find an answer that fits my needs. I have a page that pops a window (window.open), logs the user in (creates a cookie, set session) then
window.opener in the popup will refer to the window
object of the opening window, so of course you should be able to call window.opener.location.reload();
. Provided you don't run afoul of the Same Origin Policy, the popup window can call scripts and manipulate properties on the parent window object just like code in the parent can.
Here's a live example demonstrating the child calling back to a function on the parent, and also manipulating the parent directly. The full code for this is quoted below.
But that example didn't do exactly what you said, so I've done this one as well, which has the child refreshing the parent page via window.opener.location.reload()
.
Parent code of first live example:
Parent Window
(You don't have to use a scoping function as I did above, but it's useful to keep your globals contained.)
Child code of first live example:
Child Window
I'm the child window