window.opener在firefox中为null

siv*_*iva 4 javascript firefox

我有一个打开弹出窗口的页面

openWindow(top, 'prcsTypeSelectionPopup?event=prcsTypeSelection', 'lovWindow', {width:750, height:550}, true, 'dialog', pathCallBack);
Run Code Online (Sandbox Code Playgroud)

并且弹出窗口具有以下代码

function returnSelect()
{
    window.document.forms[0].choice_processType.value ;
    window.opener.document.forms[0].pevent.value = 'getprocessName';
    window.opener.document.forms[0].processName.value='';
    for (var i=0; i < document.forms[0].elements.length; i++)
   {
   if (document.forms[0].elements[i].checked)
      {
      window.opener.document.forms[0].processName.value=document.forms[0].elements[i].value;
      break;
      }
   }
   if(window.opener.document.forms[0].processName.value=='')    {
        window.opener.document.forms[0].lovProcessType.value = '';
        window.opener.document.forms[0].pevent.value = '';
   }
    window.opener.document.forms[0].submit();
    closeConn();
}

function closeConn()
{
         self.close();
}
Run Code Online (Sandbox Code Playgroud)

但是当页面加载到firefox中时,我得到错误,因为window.opener在returnselect()函数的第二行是null

function returnSelect()
    {
        window.document.forms[0].choice_processType.value ;
        --> window.opener.document.forms[0].pevent.value = 'getprocessName';
Run Code Online (Sandbox Code Playgroud)

任何想法如何克服这一点

提前致谢...

ser*_*ach 7

您从另一个域/子域打开一个窗口.在这种情况下,您无权访问打开目标窗口的父窗口,因为安全权限不允许这样做.

例如,如果你打开的网页site2.com从一个页面site1.com目标窗口有它的揭幕战.

如果您从site1.site.com的页面打开site2.site.com的页面,它也无法访问,因为这是两个不同的站点.

但是,如果你的页面site.com页从页site.com或页面subdomain.site.com从页面site.com您拥有的访问因为安全权限允许的.

注意:也许'prcsTypeSelectionPopup?event = prcsTypeSelection'不正确.将其更改为没有域的根正确路径,例如:

/ prcsTypeSelectionPopup?事件= prcsTypeSelection


siv*_*iva 2

它仅适用于“parent.window.opener”,不适用于“window.opener”

感谢 Sergzach 抽出宝贵时间