Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

444
Views
Automatically Close child window(tab) on closing parent window in React

I am trying to implement feature on my react app,

I want to close my child tab (Build with Reactjs) whenever my parent Tab (that is actually opening my React App).

Child tab is closing when I am refreshing it But not closing on real time.

Here is some code that I am trying.

useEffect(() => {
        Events.emit(types.PARENT_CLOSE, '');
        loadApplication();
    }, [window.parent.location]);
    
    useEffect(() => {
        if(window.location !== window.parent.location || true){
        Events.on(types.PARENT_CLOSE, () => {
            window.opener = null;
            window.open('', '_self');
            window.close();
          });
        }
          return ()=>{
            EventSource.off(types.CLICK_AWAY)
          }
        
    }, []);```

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!