Detect Browser Close on Asp.net

前端 未结 3 686
余生分开走
余生分开走 2020-12-03 03:57

I want to do some functionality on log-out, if the user directly closed his browser then same functionality want to do, we can not do on page unload because there are more

3条回答
  •  一整个雨季
    2020-12-03 04:47

    You can have a button for the "logout" case.

    Unfortunately, there is no reliable way to be notified if the user closes their browser. Other than client-side page unload, which you've said you don't want, about the only other option is periodic Ajax-based polling; both are ugly and notoriously unreliable.

    In general, server-side timeouts are a better approach.

提交回复
热议问题