Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda