為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Firefox Deleting Session Cookies

  • 10 回覆
  • 14 有這個問題
  • 1 次檢視
  • 最近回覆由 dojima

more options

Prior to the past couple of days (perhaps before the recent update to FF26), upon close, Firefox would delete all stored cookies except the ones related to tabs I had open at the time. When reopening Firefox, my session would be restored, and my logins to various sites would remain active.

Recently this behavior seems to have changed. Despite browser.sessionstore.privacy_level being set to 0 and browser.startup.page being set to 3, Firefox keeps deleting the cookies for my session. My history settings remain unchanged from what they were before I had the issue. I have Firefox set to accept cookies from sites, always accept third-party cookies, and keep them until I close Firefox. Under 'Clear history when Firefox closes', I have everything checked except for 'Browing & Download History'. If I change 'Keep until' to 'they expire' and uncheck cookies in the clear history settings, it will retain my session cookies, but it will also retain the cookies for websites not in my session. I have not installed any add-ons recently, and I have unsuccessfully tried every combination of history settings in an attempt to reach the previous behavior before this issue arose.

Curiously, Firefox only seems to delete some cookies. For instance, it remembers my Google username, but not the password or the fact that I was logged in. It also remembers the login for this forum and keeps me logged in completely. On Twitch, it seems to delete all cookies, completely logging me out.

I'm using Firefox 26 on Windows 7 64-bit.

Thanks for any help.

Prior to the past couple of days (perhaps before the recent update to FF26), upon close, Firefox would delete all stored cookies except the ones related to tabs I had open at the time. When reopening Firefox, my session would be restored, and my logins to various sites would remain active. Recently this behavior seems to have changed. Despite browser.sessionstore.privacy_level being set to 0 and browser.startup.page being set to 3, Firefox keeps deleting the cookies for my session. My history settings remain unchanged from what they were before I had the issue. I have Firefox set to accept cookies from sites, always accept third-party cookies, and keep them until I close Firefox. Under 'Clear history when Firefox closes', I have everything checked except for 'Browing & Download History'. If I change 'Keep until' to 'they expire' and uncheck cookies in the clear history settings, it will retain my session cookies, but it will also retain the cookies for websites not in my session. I have not installed any add-ons recently, and I have unsuccessfully tried every combination of history settings in an attempt to reach the previous behavior before this issue arose. Curiously, Firefox only seems to delete some cookies. For instance, it remembers my Google username, but not the password or the fact that I was logged in. It also remembers the login for this forum and keeps me logged in completely. On Twitch, it seems to delete all cookies, completely logging me out. I'm using Firefox 26 on Windows 7 64-bit. Thanks for any help.

由 dojima 於 修改

被選擇的解決方法

Everyone's needs are different, but my strategy is to set "session only" as the default for all cookies, and then NOT clear cookies at shutdown. There are some sites where I want to stay logged in, so I create exceptions for those sites allowing them to create persistent cookies. You might not want to create any exceptions, so it should be a fairly simple fix for you.

(1) Set cookie lifetime to session only

orange Firefox button (or Tools menu) > Options > Privacy

Set "Keep Until: I close Firefox"

(2) Do not clear cookies at shutdown

orange Firefox button (or Tools menu) > Options > Privacy > "Settings" button

從原來的回覆中察看解決方案 👍 2

所有回覆 (10)

more options
more options

I first had an issue where cookies wouldn't save after closing Firefox no matter what settings I used, so I read that thread and did manage to fix it by deleting all cookies manually, but the issue remains where it won't save my session cookies.

Thanks.

more options

Try this:

Go to "Tools" >> "Options" >> "Privacy" , in the option " The Firefox must:" set "Never memorize", click on OK

Go to your address bar and type "about:config", in the search bar, type "browser.privatebrowsing.autostart" will apper a single option change this optionto true.

more options

Do you use any cookie or privacy related extensions (or external software) that might be altering Firefox's normal behavior?

Have you noticed anything else going wrong with the session restore feature that might suggest the file has become corrupted in some manner?

more options

Actually, you have Firefox set to clear cookies on shutdown. Why did that combination ever work?!

Apparently the fact that cookies in your session store file were not cleared was a bug that was fixed, perhaps accidentally, in Firefox 26. (Based on the last comment here: 662485 – Clear history when Firefox closes: cookies, doesn't clear session cookies in Firefox 4+)

You may need to find a new cookie management strategy...

由 jscher2000 - Support Volunteer 於 修改

more options

Wow, nice researching, jscher2000.

Well, this page seems to imply that there's a way to have Firefox only save the cookies of your session, otherwise why would they have that feature at all? There would just be an option to delete all cookies on close or none of them, not a session specific retention of data.

Although I suppose it's possible that browser.sessionstore.privacy_level just doesn't work as it's fully intended, because as I mentioned, it does maintain my logins for some sites—this one, for example—when I have 'keep until' set to 'they expire' and 'cookies' checked in the clear history settings. My sense is that this is indeed the thrust of the issue.

Thanks.

more options

選擇的解決方法

Everyone's needs are different, but my strategy is to set "session only" as the default for all cookies, and then NOT clear cookies at shutdown. There are some sites where I want to stay logged in, so I create exceptions for those sites allowing them to create persistent cookies. You might not want to create any exceptions, so it should be a fairly simple fix for you.

(1) Set cookie lifetime to session only

orange Firefox button (or Tools menu) > Options > Privacy

Set "Keep Until: I close Firefox"

(2) Do not clear cookies at shutdown

orange Firefox button (or Tools menu) > Options > Privacy > "Settings" button

more options

That solution seems fine, but I can't seem to get exceptions to save. I even tried renaming the places, cookies, and permissions sqlite files thinking it was a corruption, but it still wouldn't save my exceptions. Whenever I close Firefox, they disappear from the exceptions list, and there's no mention of the exception in about:permissions. When I rename all the sqlite files, I can get them to appear in about:permissions after a close, but 'Set Cookies' changes back to 'Allow for Session' rather than 'Allow'. Very bizarre.

Thanks.

more options

Do not clear the Site Preferences as well.

Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

Clearing cookies will remove all specified (selected) cookies including cookies with an allow exception that you would like to keep.

more options

Ah, that was indeed the issue.

Thanks for the help, jscher2000 and cor-el. Looks like that'll work just fine for my needs.  :-)