JS 打开新 window 并在 N 秒后关闭新 window

JS Open new window and close new window after N seconds

我想用 javascript(window.open("some_url")) 打开一个新的 window,一段时间后我想关闭那个 window。这可能使用 javascript?

打开window,然后在一段时间后使用setTimeout关闭。

var newWindow = window.open("some_url");
setTimeout(() => newWindow.close(), 1000);

是的,是的。尝试 setTimeout 完成此任务:

const windowGoogle = window.open('http://google.com', '_blank');

//This will close google's window after 3000 miliseconds
setTimeout(() => {
  windowGoogle.close()
}, 3000)