How can I reload the parent page in this scenario:
Parent domain: sub.abc.com
Popup domain: abc.com
Using window.opener.location.reload(); from the popup only works when the domains are equal (should also when the popup is a subdomain of parent).
I have tried to reload on onunload event in parent:
var targetWin = window.open(...
targetWin.onunload = function(){
window.location.reload();
};
This triggers too early, probably since the popup redirects.
I have also tried to explicitly set the domain in parent like this:
document.domain = "abc.com";
This has no effect, I still get the error
Unsafe JavaScript attempt to access frame with URL
http://sub.example.com/ from frame with URL http://example.com. Domains, protocols and
ports must match.
Do I have to resort to some hideous polling function to check if targetWin.closed == true?
This question has been up for two weeks and i have come to the conclusion that there is no way of doing this without polling.
The reason, as stated in the question, is that the parent is a sub domain of the popup.