javascript - Delete the session on browser close in nodejs - Stack Overflow

It is possible to delete the session in node js when the browser closes?I want to have the check that i

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 badges
Add a ment  | 

2 Answers 2

Reset to default 4

That'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
    });
    -----
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744712132a4589405.html

相关推荐

  • javascript - Delete the session on browser close in nodejs - Stack Overflow

    It is possible to delete the session in node js when the browser closes?I want to have the check that i

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信