How do I determine if onbeforeunload was caused by clicking the close button or a page refresh or generally what event caused onbeforeunload?
here is a snippet:
If the close button was pressed the value of e.clientY is negative. For the other possible sources i doubt there is a solution.
e.clientY
window.onbeforeunload = function() { var e = window.event; alert(e.clientX + " / " + e.clientY); }