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

217
Views
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
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!