문제

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.

도움이 되었습니까?

해결책

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");
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top