iframe popup refresh parent window not working in chrome or safari

风格不统一 提交于 2019-12-11 06:39:23

问题


while in an iframe a user submits a popup window form.

the popup window closes and the parent window reloads redirecting user back to homepage.

here is the iframe code:

<iframe src="iframe.php"></iframe>

here is the popup inside the iframe:

function popupwnd(url, toolbar, menubar, locationbar, resize, scrollbars, statusbar, left, top, width, height)
{
   if (left == -1)
   {
      left = (screen.width/2)-(width/2);
   }
   if (top == -1)
   {
      top = (screen.height/2)-(height/2);
   }
var popupwindow = this.open(url, '', 'toolbar=' + toolbar + ',menubar=' + menubar + ',location=' + locationbar + ',scrollbars=' + scrollbars + ',resizable=' + resize +  ',status=' + statusbar + ',left=' + left + ',top=' + top + ',width=' + width + ',height=' +  height);
}

<a href="javascript:popupwnd()" target="_parent" title="Login into the Site">Login To Buy</a>

here is the javascript to close the poup window and redirect user to homepage:

<script>
    window.opener.location = /; 
    window.close();
</script>'; 

this process doesn't work in chrome or safari but does in IE and firefox.


回答1:


Using window.opener.parent.location.href instead of window.opener.location works in Chrome and Safari



来源:https://stackoverflow.com/questions/12604626/iframe-popup-refresh-parent-window-not-working-in-chrome-or-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!