Cross Domain Popup opener reload

less than 1 minute read

A couple of days ago I had the problem that I needed to reload the opener from a popup window. Thought that it should be a breeze. Simply call opener.reload() and I’m done. Far from it!

The parent and popup window have different domains and therefore the Same Origin Policy applies sigh The usual hint is using a proxy to circumvent having different domains for parent and child window, but I’m simply not position for doing that.

I was nearly giving up when I found a very simple solution.

You’re not allowed to call opener.reload(), but you are allowed to set the location of the parent window with window.opener.location.href = parentUrl;

If you know the parent URL for some reason it’s very simple, otherwise just put it in the popup’s query string and you’re done.