"Access is Denied" error in javascript - Stack Overflow

I am using window.open(0 method to open a new popup window. It's showing javascript error "Ac

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

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

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

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
Share Improve this question edited Jun 11, 2009 at 7:46 EndangeredMassa 17.5k8 gold badges56 silver badges81 bronze badges asked Jun 11, 2009 at 7:31 Raja DRaja D
Add a ment  | 

1 Answer 1

Reset to default 4
  1. See if you have any popup blockers enabled.
  2. 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/projects/security/ponents/ConfigPolicy.html
  3. make sure that your current script can access the window object. Some scripts in iframes, etc cannot open window objects.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745596996a4635176.html

相关推荐

  • &quot;Access is Denied&quot; error in javascript - Stack Overflow

    I am using window.open(0 method to open a new popup window. It's showing javascript error "Ac

    21小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信