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

143
Visualizações
Cant close a popup B from a page A within the webView browser

I tried to find a solution here but couldn't.

The problem is the following:

  • I have a page A that opens a popup B that has some authentication.
  • After the authentication, page A(the window.opener page) closes the popup page B when it receives all done from the backend.

It works fine except when its opened from the webView "browser" from within the facebook app or chat on a phone.

So far I can see that the webView limitation is that you can only have one active tab. So when page A is not active its javascript code is not executed and the popup wont be closed.

You can test this with this fiddle from the webView browser.

let w = null;

window.addEventListener("DOMContentLoaded", (event) => {
  document.querySelector("button").addEventListener("click", () => {
    w = window.open("https://www.google.com", "customPopup", popupFeatures);
    window.setTimeout(() => {
        if (w) { w.close() }
        alert('parent js is working');
    }, 3000);
  });
  
});

const popupFeatures =
  "menubar=no,location=no,resizable=no,scrollbars=yes,status=no,width=700,height=700";
<button>.......CLICK here....</button>

Some limitations I cant circumvent:

  • Page B has to be a popup because safari blocks third party cookies, so no Iframe on page A.
  • The popup page / code doesn't have a redirect option, and I have no control over it.
  • The popup page also doesn't use postMessage or other method of communicating with other pages, I get the all done only from our backend that's requesting it from theirs.
  • I cant setup the popup B with my code because soon after opening, it redirects to another third party page.

Is there a way to keep the javascript code on page A to keep executing or being able to close the popup?

The main problem is after the popup opens and the user finishes with the authentication the flow is stuck there because I cant close it from page A since its javascript thread is not active.

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