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,429
  • 1
  • 18
  • 42
Alessandro C
  • 3,070
  • 6
  • 36
  • 74
  • 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