If a popup is created using window.open , then a popup can open an open window using window.opener .
In the main window, you should create a function to receive data from a popup window, something like this:
window.receiveDataFromPopup = function(data) {
Then in the popup you can call this function on the opener as follows:
window.opener.receiveDataFromPopup(data);
To close the window, simply use
window.close();
source share