共用方式為


由 window.open() 開啟的 Windows 不會反映Microsoft Edge 中指定的大小和位置

警告

已淘汰、不受支援的 Internet Explorer 11 傳統型應用程式已於特定 Windows 10 版本透過 Microsoft Edge 更新永久停用。 如需詳細資訊,請參閱 Internet Explorer 11 傳統型應用程式淘汰常見問題

本文提供的資訊顯示,透過呼叫 window.open() 函式所設定的值,將不會反映在 Microsoft Edge 的新視窗中。

原始產品版本: Internet Explorer
原始 KB 編號: 3146494

徵兆

試想以下情況:

  • 您在 Microsoft Edge 中開啟網頁。
  • 網頁會呼叫 函式並 window.open() 設定值,以指定視窗的大小和位置。
  • 呼叫 window.open() 函式的視窗目前未最大化。 在此案例中,指定的大小和位置不會反映在新視窗中。

其他相關資訊

您可以遵循下列步驟來重現此問題:

  1. 將下列 HTML 程式代碼儲存為 original.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <title>window.open - TEST</title>
            <script type="text/javascript">
                function win_open1() {
    window.open('about:blank','','titlebar=yes,toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=700,Height=300,left=0,top=0');
                }
            </script>
        </head>
        <body>
            <input type="button" name="btn1" value="btn1" onclick="win_open1();" />width=700,Height=300,left=0,top=0<br>
        </body>
    </html>
    
  2. 在 Microsoft Edge 中開啟 original.html

  3. 如果 Edge 視窗大小最大化,請將它還原為一般大小。

  4. 按兩下 按鈕 可呼叫 window.open 寬度 為700像素 且高度 為300-px 參數的函式。 在此案例中,開啟的視窗大小不會如預期 般為 700x300