LoginSignup
16
15

More than 5 years have passed since last update.

javascriptで指定時間後にwindowを閉じるアレ

Last updated at Posted at 2015-01-26

思いの外調べるのにてこずったのでメモ。

setTimeout(function () {
    window.open('about:blank', '_self').close();
}, 1000);

window.closeだとブラウザ依存で閉じれない場合があります。
http://kojikoji75.hatenablog.com/entry/2013/12/15/223839

setTimeoutの第二引数で第一引数実行までの時間を指定できます(単位はミリセコンド)

16
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
15