Domanda

Is it possible to reload the parent page when a child popup window is closed? the child popup is in a different domain unfortunately. If so, how? I am working with IE7+, but the site is in compatibility mode. I.e., I am trying to do something like:

//in parent window
var popup = window.open('http://otherdomain.com/popup', '', 'status=no,toolbar=no,scrollbars=yes,menubar=no,directories=no,location=no,top=0,left=0,resizable=yes');

popup.onunload = function(){
    window.location = window.location;
};

I've had some code work while within the same domain, but when cross domain, that produced:

0x800a0046 - JavaScript runtime error: Permission denied

I know that popups are a bad practice, but that's what I have to do in this case.

It seems like postmessage doesn't work in IE7.

È stato utile?

Soluzione

If you can add code to the popup, add this in the parent window

window.name="mainwindow";

and add this in the popup

window.onbeforeunload=function() {
  window.open("http://openersite.com/whatever","mainwindow");
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top