window.open, opened the current window. The code to use is the following:
1 2 3 4
First it checks if the opener window is still open. In this case, it closes the current window and call the
function on the opener window.