Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda