window.open with target “_blank” in Chrome

后端 未结 5 1308
清歌不尽
清歌不尽 2020-12-06 10:20

I have a small javascript function which opens an url in a new tab:

function RedirectToPage(status) {
   var url = \'ObjectEditor.aspx?Status=\' + status;
           


        
相关标签:
5条回答
  • 2020-12-06 10:28

    It's a setting in chrome. You can't control how the browser interprets the target _blank.

    0 讨论(0)
  • 2020-12-06 10:43

    "_blank" is not guaranteed to be a new tab or window. It's implemented differently per-browser.

    You can, however, put anything into target. I usually just say "_tab", and every browser I know of just opens it in a new tab.

    Be aware that it means it's a named target, so if you try to open 2 URLs, they will use the same tab.

    0 讨论(0)
  • 2020-12-06 10:43

    You can't do it because you can't have control on the manner Chrome opens its windows

    0 讨论(0)
  • 2020-12-06 10:43

    As Dennis says, you can't control how the browser chooses to handle target=_blank.

    If you're wondering about the inconsistent behavior, probably it's pop-up blocking. Many browsers will forbid new windows from being opened apropos of nothing, but will allow new windows to be spawned as the eventual result of a mouse-click event.

    0 讨论(0)
  • 2020-12-06 10:46
    window.open(skey, "_blank", "toolbar=1, scrollbars=1, resizable=1, width=" + 1015 + ", height=" + 800);
    
    0 讨论(0)
提交回复
热议问题