Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

65
Views
How to close popup and redirect to parent window?

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()
 
7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.