Is there a way to determine that the browser window was closed?

前端 未结 8 386
感动是毒
感动是毒 2021-01-14 12:35

How is it possible to identify that the browser\'s close button was clicked?

8条回答
  •  被撕碎了的回忆
    2021-01-14 13:37

    you could setup an ajax call that periodically polls your server every few seconds to every few minutes (depending on your wanted time precision) and track the last hit time server side. not completely accurate (eg. network issues could cause a false positive), but may be an option depending on your requirements.

提交回复
热议问题