As
Sergey Alexandrovich Kryukov suggested, it is a bad idea. So, reconsider the design.
Still I would like to give the concept to you.
Refer -
window.close[
^].
To close the opened/child window
As you have assigned
window
to the variable
popupWindow
, so you can close the window with the help of that variable only.
We can say that
popupWindow
is an
object
, which is a instance of
window
class initialized using
open
method.
Use the following code to
close
the window.
popupWindow.close();
To close the parent window
Refer
Solution 2 by
Sergey Alexandrovich Kryukov.