Chrome doesn't delete session cookies

后端 未结 13 1666
有刺的猬
有刺的猬 2020-11-22 05:25

I\'m trying to set session cookie in javascript like this:

document.cookie = \'name=alex; path=/\'

But Chrome doesn\'t delete it even if I

相关标签:
13条回答
  • 2020-11-22 05:49

    I just had this issue. I noticed that even after I closed my browser I had many Chrome processes running. Turns out these were each from my Chrome extension.

    Under advanced settings I unchecked 'Continue running background apps when Google Chrome is closed' and my session cookies started working as they should.

    Still a pain in the rear for all of us developers that have been coding expecting that session cookies would get cleared when the user is done browsing.

    0 讨论(0)
  • 2020-11-22 05:50

    Have you tried to Remove hangouts extension in Google Chrome? because it forces chrome to keep running even you close all the windows.

    I was also facing the problem but it resolved now.

    0 讨论(0)
  • 2020-11-22 05:50

    If you set the domain for the php session cookie, browsers seem to hold on to it for 30 seconds or so. It doesn't seem to matter if you close the tab or browser window.

    So if you are managing sessions using something like the following it may be causing the cookie to hang in the browser for longer than expected.

    ini_set("session.cookie_domain", 'www.domain.com');
    

    The only way I've found to get rid of the hanging cookie is to remove the line of code that sets the session cookie's domain. Also watch out for session_set_cookie_params() function. Dot prefixing the domain seems to have no bearing on the issue either.

    This might be a php bug as php sends a session cookie (i.e. PHPSESSID=b855ed53d007a42a1d0d798d958e42c9) in the header after the session has been destroyed. Or it might be a server propagation issue but I don't thinks so since my test were on a private servers.

    0 讨论(0)
  • 2020-11-22 05:55

    I had to both, unchecked, under advanced settings of Chrome :

    • 'Continue running background apps when Google Chrome is closed'
    • "Continue where I left off", "On startup"
    0 讨论(0)
  • 2020-11-22 06:00

    Go to chrome://settings/content/cookies?search=cookies

    Enable Clear cookies and site data when you quit Chrome.

    Worked for me

    0 讨论(0)
  • 2020-11-22 06:00

    I just had this problem of Chrome storing a Session ID but I do not like the idea of disabling the option to continue where I left off. I looked at the cookies for the website and found a Session ID cookie for the login page. Deleting that did not correct my problem. I search for the domain and found there was another Session ID cookie on the domain. Deleting both Session ID cookies manually fixed the problem and I did not close and reopen the browser which could have restored the cookies.

    0 讨论(0)
提交回复
热议问题