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

150
Views
JavaScript detect Popup window closed by window.close() or by mouse click

Is there any way to different if a popup window is closed by window.close() or closed by mouse click? I want to different if user manually closed the popup or not.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

check-in close event listener if the user clicks a close button then you get data and you know the user clicks manually otherwise not.

about 4 years ago · Juan Pablo Isaza Report

0

You need to bind the onbeforeunload event to the window AFTER it is opened.

The simplest way to do that would be to have the javascript onbeforeunload code within the window source code.

var pop_up_window = window.open('some url')
pop_up_window.onbeforeunload = function(){ /* your code */ }

Please check following for more details

https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
about 4 years ago · Juan Pablo Isaza Report
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!