217
Views
5
Comments
How to clear session  and when browser or tab is directly close?
Application Type
Reactive

If we close the tab or browser directly then the session and cookies should automatically be cleared.  So that the person has to log in again.


And when and where to implement this logic?

2022-11-15 07-57-26
sumant kumar

No from this, it is not possible. Without clicking on logout I want to clear the session and cookies.

2022-08-03 04-32-50
Ravi Punjwani

Hi Sumant,

If you somehow figure out that you could clear the session when the user is clicking on close tab button, how are you going to deal with the fact that there may be other tabs open for your same application?

The users using multiple tabs may not expect their login session to be cleared by just closing one of the tabs. Your strategy won't bring a good user experience. You can try thinking some more creatively and find some other way to achieve your desired expectation from the app, which also comforts the user experience.

2022-11-15 07-57-26
sumant kumar

I want to clear my session. How I can do it? and where.

2022-12-09 04-50-17
Shubham Doshi

You can clear your session after user logs out from the application. Or else if you want user session to end after closing the window then you can apply logic on 'On Destroy' event of the screen. But it is not the ideal way of doing it

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.