0

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

Elavarasan
  • 2,579
  • 2
  • 25
  • 42
Tethys
  • 77
  • 13

1 Answers1

0

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.

Community
  • 1
  • 1
Ramon Ott
  • 51
  • 2
  • Thank you I will try to do PS. in first time i want to do like my question because i saw web bank can do. – Tethys Nov 04 '14 at 09:14