10
8

More than 5 years have passed since last update.

[JavaScript] 自身がポップアップであるとき、親ウィンドウをリロードして、自身ウィンドウを閉じる方法

Last updated at Posted at 2014-10-18

やり方

私は、SNS認証をポップアップで行い、認証成功時にポップアップを閉じて、親ウィンドウ(元ウィンドウ)を閉じる、為に使いました。

ポップアップのページ(コールバックで指定したURLのページ)に以下のコードを記載するといいです。

  if(window.opener) {
    window.opener.location.reload(true);
    window.close()
  }

参考

10
8
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
10
8