0

I'm using window.onbeforeunload to intercept window close event. I've noticed that window.onbeforeunload is triggered even on location.href change and form submit.

I want to intercept only the event: "the user has closed the page". How can I do it?

**I'm open to both JavaScript or jQuery solutions.

chazsolo
  • 7,873
  • 1
  • 20
  • 44
Alessandro C
  • 3,310
  • 9
  • 46
  • 82
  • 2
    Possible duplicate of [Detect browser or tab closing](https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing) – nicholaswmin Jan 30 '19 at 14:41
  • 1
    you could track the users ip/id backend and is the ip is not requesting an other page the window could have been closed. – jsadev.net Jan 30 '19 at 14:45

0 Answers0