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

168
Views
Javascript: assign the popup tab as a variable

I have two domains on different hostings, domain A is the main website, domain B is the authorization server with simple frontend. I have very strict security policy applied, which forces the users after 1 hour to re-authorize themselves. It's done by popup window in new tab, calling domain B from the frontend of the domain A. I realized that the popup blocking policy and the fact, that not every browser behave the same, i found the only solution to bring the popup correctly (in the new tab) by this javascript call (when the timer reaches 60mins):

Object.assign(document.createElement('a'), { target: '_blank', href: 'https://domain_B/auth.php'}).click();

My problem is, that i am unable to check from the domain A, if the popup window is opened correctly and the user haven't closed it. So i need to assign a variable to the new popup tab and check if it's still available, otherwise i need to re-open it from the domain A.

So i want to do something like this:

 if(popup_win && !popup_win.closed)
  { //do my auth stuff 
   }

the problem is, that i am unable to assign the new popup to popup_win javascript variable. I can do it by calling a single window.open(url,"_blank") but as i mentioned above, the result then depends on popup-blockers and browser version/type.

Any help/suggestion appreciated!

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!