Laravel expire session on browser close not workin

2019-06-17 06:05发布

问题:

I am using Laravel Framework version 4.1.21 and the "expire_on_close" option does not end the session in Chrome when the browser is closed. The options in my config/session.php file look like this:

'driver' => 'file',
'lifetime' => 120,
'expire_on_close' => true,

Also in the developer toolbar, under Resources > Cookies, the Expires value is set to "Session" for the laravel_session cookie.

This works fine in Firefox though. Any ideas what am I missing ? Thanks !

回答1:

It's becasue of Chrome's feature. When you close Google Chrome, it actually runs on background (as mentioned on comments).

Here's detailed information: https://code.google.com/p/chromium/issues/detail?id=128513