0

I know about window.onbeforeunload, but that also executes when the user clicks on a link or refreshes the page, while I want my function to only execute when the browser or tab is closed. Is there a way to do that?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
blacktrance
  • 905
  • 2
  • 11
  • 25

1 Answers1

0

AFAIK the only options are unload and onbeforeunload so I would say the answer to your questions is "no".

https://developer.mozilla.org/en-US/docs/Web/Events/unload

Morpheus
  • 1,616
  • 1
  • 21
  • 31