代码之家  ›  专栏  ›  技术社区  ›  Anthony Kong

窗打开在不同屏幕上的不同x位置打开浏览器窗口

  •  1
  • Anthony Kong  · 技术社区  · 6 年前

    下面是一个非常简单的脚本:

    <html>
    
    <head>
    <script>
    
    function doit() {
        var features = "top=100,left=0, height=300, width=550";
        console.log(features);
        window.open('', 'test', features);
    }
    </script>
    </head>
    <body>
        <div>Hello</div>
        <button onClick="doit()">Test</button>
    </body>
    </html>
    

    如果我在主屏幕上用chrome浏览器加载页面并按下按钮,行为正是我所期望的:

    enter image description here

    在我的外部显示器上,它变成了

    enter image description here

    新窗口在屏幕最左侧打开。

    为什么?我怎样才能保证同样的行为?

    Chrome版本:70.0.3538.110

    0 回复  |  直到 6 年前