function openCenteredWindow(url ) { const width 600; const height 400; // 计算居中位置 const left Math.round((screen.width - width) / 2); const top Math.round((screen.height - height) / 2); window.open( url, _blank, width${width},height${height},left${left},top${top},toolbarno,locationno ); } const url https://example.com; openCenteredWindow(url)