I have an website. When the user is logged the session details will loaded. When the user logged out the session details will abandoned. (Log out by clicking the logout menu
You have basically two options:
Each solution will work on 99%, if you combine them, you should be pretty much set on 99.99% of cases. Depends how important this behavior is to you.