javascript中的“访问被拒绝”错误

时间:2022-08-14 15:55:52

I am using window.open(0 method to open a new popup window. It's showing javascript error "Access Denied". My code is below:

我正在使用window.open(0方法打开一个新的弹出窗口。它显示javascript错误“Access Denied”。我的代码如下:

Script Code:

function wopen(url, name, w, h)
{
    var win = window.open(url,
                  name, 
                  'width=' + w + ', height=' + h + ', ' +
                  'location=no, menubar=no, ' +
                  'status=no, toolbar=no, scrollbars=no, resizable=no');
    win.resizeTo(w, h); 
    win.focus();       
}

HTML Code:

<a href="<%=link("*","PopupDisplay")%>" target="popup" 
    onClick="wopen('<%=link("*","PopupDisplay")%>', 'popup', 450,200); return false;" 
    id ="CommerceQuery_fourpartlink"4 Part Key#</a>

// "PopupDisplay" will forward to the corresponding link

1 个解决方案

#1


  1. See if you have any popup blockers enabled.
  2. 看看你是否启用了任何弹出窗口阻止程序。

  3. A security restriction on window.open is that you can only open windows in the same domain, to prevent any cross domain security forgeries. see http://www.mozilla.org/projects/security/components/ConfigPolicy.html
  4. window.open的安全限制是您只能在同一个域中打开窗口,以防止任何跨域安全伪造。请参阅http://www.mozilla.org/projects/security/components/ConfigPolicy.html

  5. make sure that your current script can access the window object. Some scripts in iframes, etc cannot open window objects.
  6. 确保您当前的脚本可以访问窗口对象。 iframe等中的某些脚本无法打开窗口对象。

#1


  1. See if you have any popup blockers enabled.
  2. 看看你是否启用了任何弹出窗口阻止程序。

  3. A security restriction on window.open is that you can only open windows in the same domain, to prevent any cross domain security forgeries. see http://www.mozilla.org/projects/security/components/ConfigPolicy.html
  4. window.open的安全限制是您只能在同一个域中打开窗口,以防止任何跨域安全伪造。请参阅http://www.mozilla.org/projects/security/components/ConfigPolicy.html

  5. make sure that your current script can access the window object. Some scripts in iframes, etc cannot open window objects.
  6. 确保您当前的脚本可以访问窗口对象。 iframe等中的某些脚本无法打开窗口对象。