I would like the logged in member to be automatically logged out when he leaves the site, or when the browser is closed.
He will then have to log in again during the next visit to the site.
Is this possible?
Thank you in advance for your help.
Product:
Wix Editor
What are you trying to achieve:
To logout the member when he leaves the website
Yes, it is possible to automatically log out a member when they leave the site or close the browser in Wix Editor, but you will need to use custom code for this functionality.
To automatically log out a member when they leave the site or close the browser, you can use the window.onbeforeunload event combined with Wix’s wixUsers.logout() function. This detects when a user navigates away or closes the browser and logs them out securely. While effective, it’s worth noting that this approach resets the user session entirely, requiring re-login on each visit, and may behave inconsistently across some browsers. If you’d like to explore this solution further or discuss other innovative coding techniques to enhance your site’s functionality, let’s set up a quick meeting. We can dive into your specific needs, tackle challenges, and brainstorm ideas to optimize your project.