admin管理员组文章数量:1390604
It is possible to delete the session in node js when the browser closes?
I want to have the check that if the user did not select the keep me login checkbox and then closes the window. He should asked to re login.
It is possible to delete the session in node js when the browser closes?
I want to have the check that if the user did not select the keep me login checkbox and then closes the window. He should asked to re login.
Share Improve this question asked Nov 6, 2012 at 15:19 Ali HassanAli Hassan 6071 gold badge11 silver badges24 bronze badges2 Answers
Reset to default 4That's a cookie-specific setting: If you store the session data in a session-only cookie, it will disappear when the browser closes.
See this answer to make a browser-session cookie with express: Node.js/Express.js session management cookie to be session cookie
You can write your own session delete function on event 'disconnect'
socketServer.sockets.on('connection', function onSocket(client) {
client.on('disconnect', function() {
console.log("disconnect");
// some code
});
-----
});
本文标签: javascriptDelete the session on browser close in nodejsStack Overflow
版权声明:本文标题:javascript - Delete the session on browser close in nodejs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744712132a2621191.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论