Next.js Discord

Discord Forum

Detect Browser Close

Unanswered
Albacore posted this in #help-forum
Open in Discord
AlbacoreOP
Hello, I am using Clerk, and I want to logout of my website when the browser is closed. How do I detect this? I've tried using the beforeunload event to detect this, however it also would fire when the page is being navigated away or refreshed. How can I ensure the user is logged out when the browser is closed? Thanks.

0 Replies