We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I set cookies to ask every time, get cleared when I restart, _and_ keep my exceptions?

  • 11 replies
  • 3 have this problem
  • 16 views
  • Last reply by kobaltkween

more options

I want to clear all cookies on restart. I also want to be asked if I want to accept cookies from a site or not. In Linux and in previous versions of Windows Firefox, it works to have "Keep until:" set to "ask me every time," and my Clear history set so that everything in "History" is checked (including cookies) and everything in "Data" is not. But now my Cookie exceptions are clearing with the cookies at restart, instead of obeying the unchecked "Site preferences" under Data. How can I get it to behave as it did previously, which was in accordance with the settings, instead of an incorrect clearing of site preferences?

I want to clear all cookies on restart. I also want to be asked if I want to accept cookies from a site or not. In Linux and in previous versions of Windows Firefox, it works to have "Keep until:" set to "ask me every time," and my Clear history set so that everything in "History" is checked (including cookies) and everything in "Data" is not. But now my Cookie exceptions are clearing with the cookies at restart, instead of obeying the unchecked "Site preferences" under Data. How can I get it to behave as it did previously, which was in accordance with the settings, instead of an incorrect clearing of site preferences?

All Replies (11)

more options

You need to exclude the Site Preferences.

Clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, passwords, and other website specific data.

You can consider to let all cookies expire when Firefox is closed to make them session cookies.

  • Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: Keep until: "I close Firefox"

Create a cookie 'allow' exception for cookies that you would like to keep.

  • Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: Exceptions

You can allow third-party cookies only from visited domains.

  • Tools > Options > Privacy > Firefox will: "Use custom settings for history"

You can set the network.cookie.thirdparty.sessionOnly pref to true on the about:config page to make third-party cookies behave as session cookies that expire when Firefox is closed.

more options

I'm sorry, but you don't seem to have read my statement properly. As I said, " and everything in "Data" is not [checked]. "[I]nstead of obeying the unchecked "Site preferences" under Data," my site preferences are being cleared. Firefox is not functioning as it's supposed to, or even as it used to until very recently. I am saying to leave Site preferences alone, but it is incorrectly clearing my cookie exceptions.

If I "Keep until: I close Firefox," rather than "Ask me every time," I will get tons and tons of cookies I don't want. I don't need exceptions to keep any cookies, I want _all_ of them gone each time I close Firefox. If my history clears as it should, it will never allow any cookies after the history clears if I say only allow from visited domains. But even if it worked on visited domains, I would have to make each exception by hand as I went to new sites I wanted to accept cookies from. What I want is to be asked _every time_ a new site asks to set cookies, but not to be asked when an old site does. This is only achievable by Firefox properly clearing the cookies but _not_ the exceptions when I set it to clear cookies on closing.

My settings worked just fine until two updates ago. They still work fine in Linux, with the most recent Firefox. Only in the most recent Firefox for Windows do I have to build my exceptions each time I restart, despite deliberately telling it _not_ to clear them.

more options

Do you have the same problem with other exceptions that you set?

You can try to rename (or delete) the content-prefs.sqlite file to content-prefs.sqlite.old in the Firefox profile folder in case there is a problem with the current file.

You can use this button to go to the currently used Firefox profile folder:

more options

No, I don't think I have the problem with any other exceptions. I'll try your suggestion, but I highly doubt it's a problem with the file. I had the problem in Windows XP 64 on a totally different system, set up a new system using Windows 7 64 bit, newly installed Firefox, and have the same exact problem. As I said, it was fine for years in fact, and it's only been a problem for maybe a few months and I think only two upgrades. And it's still fine in Linux.

To be honest, it seems like is that someone decided that they didn't want people to be able to deny cookies on their system and changed Firefox to make it much more inconvenient to do by overriding the preferences and tying the cookie exception dump to the cookie dump. And avoided the ire of Linux users who are more likely to want full control. If there's a way I can override this change, I'd love to hear it. But it's not this particular install, and it's not my specific and current files. In fact, I saw you advise others on this problem before posting, and your advice was always a work around that avoided giving people the functionality that the settings I've described give. They all gave up their ability to refuse cookies from places they don't trust. I _really_ don't want to give up that ability. My ability to control my cookies has been one of the main reasons I choose Firefox.

cor-el said

Do you have the same problem with other exceptions that you set? You can try to rename (or delete) the content-prefs.sqlite file to content-prefs.sqlite.old in the Firefox profile folder in case there is a problem with the current file. You can use this button to go to the currently used Firefox profile folder:
more options

Wow. Well, that failed spectacularly. As I predicted, renaming the file didn't make Firefox work properly. As neither of us predicted, it just deleted the .old file and wiped my saved passwords, totally messing me up and destroying my access to several important accounts. Oh, and restarting Firefox after the rename seemed to crash my computer. So you might warn people about that.

Modified by kobaltkween

more options

What file(s) did you rename?

Did you rename the Firefox profile folder with the xxxxxxxx.default name tp xxxxxxxx.default.old and not the content-prefs.sqlite file in it?

Passwords are stored in logins.json and shouldn't be affected by renaming content-prefs.sqlite to content-prefs.sqlite.old.

more options

I renamed the content-prefs.sqlite file, not the folder. And that's all I did. But the logins are gone.

more options

Are they gone fro the Password Manager?

  • Tools > Options > Security: Passwords: "Saved Passwords" > "Show Passwords"

Details like websites remembering you (log you in automatically) are stored in a cookie. So if you mean that you are no longer remembered then you lost those cookies.


I see that I posted the wrong file name. Exceptions and permissions are stored in permissions.sqlite and not in content-prefs.sqlite. The latter only stores some site specific setting like page zoom and download locations for upload and download.

more options

Yes. They are gone. I know how cookies work. And apparently it _does_ have some password information, because they are completely gone. I had to reset passwords on several sites.

more options

I can't think of a reason why they would disappear from the Password Manager if that is what you meant with "Yes. They are gone.". That really shouldn't happen as the result of renaming content-prefs.sqlite.

Are you using Sync to sync passwords?

Modified by cor-el

more options

No, I am not using Sync. Looking at the file with a sqlite browser, it's saving 3 "blobs" of binary data regarding site preferences. I wouldn't be surprised if that didn't have something to do with the issue. IIRC, to get my passwords to come over from my old copy (now gone), I had to copy both logins.json and content-prefs.sqlite. But even if I didn't it's moot. The passwords are gone, and that's over. And totally irrelevant to my main problem.

I would still like a way to keep my cookie exception preferences from wiping with each restart. I would like only my cookies to wipe with each restart, but also to have each site ask me whether it can set cookies or not when I first encounter it. This has not been working on two totally different operating systems of mine, even when nothing else was on the box but Windows and Chrome and all I'd done is personalize my preferences. Nor has it been working on the people's systems that I've seen ask you about it in this help system. And none of the times you answered ended with the person getting the correct behavior. You told them the same thing you told me. Turn off the cookie wipe, turn off asking to set cookies, and tell cookies to last until closing Firefox. In other words, totally change settings from what should work but doesn't, and replace them with settings that leave your system more vulnerable than the original ones.

My specific system seems irrelevant if totally different users have had the same problem, and you've always given them a substitution rather than a fix.

The settings on the restart wipe- wipe cookies but not site preferences- should keep the cookie exception site preferences. Those settings worked until a few Windows Firefox upgrades ago. They stopped working when the only change I made to Firefox was allowing it to upgrade. They still work on Linux.

Is there a way I can get them to work on Windows again? If your only answer is the workaround that you gave everyone else, then I totally understand and I'd like to know where I can make some sort of complaint, bug report, or feature request to make things work like they did before and like they still do on Linux.