how to identify onbeforeunload was caused by clicking close button

后端 未结 4 1324
囚心锁ツ
囚心锁ツ 2020-12-07 03:08

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:

4条回答
  •  甜味超标
    2020-12-07 03:47

    As far as I know, there is no way of determining what caused the onbeforeunload. The event is triggered when window is about to close whether closing the browser or some other way.

提交回复
热议问题