JavaScript 打开小窗口的实现方法
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},toolbar=no,location=no` ); } const url = "https://example.com"; openCenteredWindow(url)