On the main page, you save the popup in W1 and define a function that closes W1:
W1 = window.open("","","width=100,height=100"); function closeW1() { W1.close(); }
Now on W1 in the same place where you open W2:
okBtn.onclick = function() { W2 = window.open("","","width=100,height=100"); window.opener.closeW1(); }
What is it. Everything is ready.
source share