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

221
Visualizações
Anyone know the way to know the popup window which is opened by form is closed?

I opened the popup window in Javascript and want to get the event when it is closing.

// Main.js
const fnPopup = () => {
    var popup = window.open('', 'pChk', 'width=500, height=500, scrollbars=no, status=no, menubar=no');
    popup.onbeforeunload = () => {
        console.log("[NOTIFY] This Popup will be closed");
    };
};

Above code is working well. When popup is closed, TEST console log is printed. BUT I should submit the data by form because some some authorization data should be sent. So I changed the code like below but it is not working well.

// Main.js
const fnPopup = () => {
    var popup = window.open('', 'pChk', 'width=500, height=500, scrollbars=no, status=no, menubar=no');
    popup.onbeforeunload = () => {
        console.log("[TEST] This Popup will be closed");
    };

    document.autho_form.action = "https://myAuthorizationSite.com/autho.cb"; // The site of Service Provider (Not our code)
    document.autho_form.target = "pChk";
    document.autho_form.submit();
};

In this case, above TEST console log is printed once while move to action site. But after page is moved, TEST log didn't printed although popup window is closed.

SUMMARY: Can anybody help to teach the way to get the event when the popup window which is submitted by form is closed? Additionally, I should modify Main.js only. Thanks in advance.

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