0

Let there be three windows.

GrandParent->parent->child.

GrandParent opens parent and parent opens child.

In our case child closes automatically and returns to parent. but when parent is closed it doesn't return to GrandParent instead it goes to another tab.

I already tried the solution of creating a function in grandparent and calling it in parent. But it doesn't work.


// GrandParent 
window.open(url) // url to open payment gateway in popup

// add function in grandParent to focus on parent window when popup closes
window.receiveDataFromPopup = function(data) { console.log(data) };

// Now grandparent opens parent

// parent opens another popup(child) for OTP and closes after verification

// Now we are at parent 

// call grandparent function to focus on it
window.opener.receiveDataFromPopup('hola');

//close parent popup
window.close()
 
  • Hi Please share code to demonstrate your intensions. Could be a simple bug we can find for you, could be a misnamed window... all kinds of things. – Peter Krebs Jan 21 '22 at 09:11
  • @PeterKrebs made the edit. please check. – Jimmy Anderson Jan 21 '22 at 09:18
  • Please post the real code, not just pseudocode. Also consider posting a working example. See [How to create a minimal reproducable example](https://stackoverflow.com/help/minimal-reproducible-example) – Peter Krebs Jan 24 '22 at 09:16
  • You can find answers to similar problems as well: [Communication between tabs or windows](https://stackoverflow.com/questions/28230845/communication-between-tabs-or-windows) – Peter Krebs Jan 24 '22 at 09:16

0 Answers0