简体   繁体   中英

Close browser not clear session automatic

Can I clear session after close Browser (not tab)

I want to log out any user if he close browser

please help me I try to do in system -> configuration -> web and set cookie Lifetime to 0 but it don't work (i try to type 30 but admin page auto log out in 30 sec (still open admin page) but not have any change to webpage both still open or close)

where to config about that or Magento can use any code like '$config['sess_expire_on_close'] = TRUE;' in codeigniter

PS. I try to use unload code to try but in not work

maybe you should check out this answer: How do I expire a PHP session after 30 minutes?

you have to do it through the session lifetime (server side). you can never be sure when the user closes the browser (chrome for example can have a quicklaucher process that eliminates that functionality pretty much).

the only way that comes close it to set the session lifetime to a very low value - which means, that the use gets logged out, if he doesn't interact on the site for some time.

another way would be to implement an ajax pinger script that lets you set the session lifetime even lower and just keeps the session open, as long as the user is on your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM