Configure Firefox To Delete All Cookies On Exit But Select Ones
All web browsers accept cookies from websites in their default configuration. Cookies contain different information, from session data over individual site preferences to advertisement and tracking related data.
Cookies can generally be classified into good and bad cookies. The Internet user benefits from good cookies, for instance from cookies that contain session information. These cookies store the information that the user is already logged in on a specific site, e.g. Facebook or Yahoo Mail, so that the users does not have to enter the log in information on each page load again.
Bad cookies on the other hand do not benefit the user, they track the user across multiple web properties for instance and are generally speaking undesirable by most.
The following guide details how Firefox can be configured to allow cookies for specific websites that are beneficial to the user, and delete all other cookies that sites want to place on the computer system. Some users might even take an extra step and block all cookies but select ones in the browser.
Please note that the most recent version of Firefox is used for the guide, the settings are however very similar in older versions.
Configuring the cookie behavior in Firefox
Firefox users have two options to handle the deletion of cookies and site data in recent versions of the web browser.
- Load about:preferences#privacy in the browser's address bar to get started.
- The option "Delete cookies and site data when Firefox is closed" removes cookies and site data from Firefox when you exit the browser. You may add exceptions to keep cookies and site data for select sites.
- If you set the History to "Use custom settings for history", you get an option to "clear history when Firefox closes.
- A click on Settings displays an option to clear cookies when the option is activated.
You can load about:preferences#privacy in the Firefox address bar to open the browser's privacy preferences.
Scroll down to the History section and select "use custom settings for History" in the "Firefox will" menu.
The important elements that appear after "use custom history" is selected are:
- Accept cookies from websites
- Accept third party cookies
- Keep until
- Clear History when Firefox closes
Here are explanations for what each setting does:
- Accept third party cookies - Third party cookies are cookies that are set by scripts that originate from another website. A first party cookie comes on the other hand from the domain the user is on.
- Keep Until - The setting defines for how long cookies are stored by the browser.
- Clear History when Firefox closes - Configures Firefox to delete some or all history items, among them cookies.
Tip: Extensions may need cookies as well. Check out this guide to find out how to deal with those.
Delete Cookies On Exit, Keep Some
Firefox needs to be configured to keep some cookies while the rest gets deleted on exit. Start with a click on the Settings button next to "Clear history when Firefox closes". You may need to enable the option before it becomes available.
Remove the checkmark from Cookies. This configures Firefox to keep cookies on exit. Read on to find out why this is important. Close the menu with a click on OK.
Now click on the "Keep until they expire" pulldown menu and select "I close Firefox" from the options.
Cookies are now deleted whenever you exit the browser. Now we need to configure cookies that we want to keep.
A click on the Exceptions button opens a menu where cookie exceptions can be configured. Just enter the domain name of the website that you do not want cookies to be deleted for and the allow button afterwards to add it to the listing.
Cookies from domains in that list will not be deleted when Firefox exits. Cookies from domains not on the list will be deleted. Please note that this may result in you being automatically logged out of services on the Internet which you will notice when you open the service's website again.
You may also want to keep some third party cookies, for instance advertisement opt-out cookies. It may be a good idea to take a look at the Show cookies menu once you have finished the initial whitelisting of cookies to see if you missed any. Show cookies displays all cookies that are currently active in the browser.
The menu unfortunately has no option to allow specific cookies, which usually means lots of window switching before the cookie configuration has been completed.
Some users do not like to add web addresses to the cookie whitelist manually. Those users can use the following way instead. They need to be on the website that they want to whitelist.
A right-click on the page and the selection of View Page Info opens a window that displays information about the active website.
The Permissions tab offers to customize permissions for that specific domain. To allow cookies for the domain uncheck the Use Default option under Set Cookies and switch from Allow for Session to Allow.
Firefox will accept all cookies, most for the session, and the whitelisted ones until they expire. Some users may want to configure the browser to use even stricter rules. They have two options to achieve this.
Removing the checkmark from the "Accept third-party cookies" setting blocks all third party cookies in Firefox. That's the easiest way of blocking the majority of cookies in the web browser.
A less-strict option for third-party cookies is to switch the setting to "from visited". This blocks all third-party cookies but those set by sites you visited actively in the past.
The second option comes in the form of the Exceptions menu. The configuration menu can not only be used to allow cookies, but also block cookies from domains that are entered.
One of the greatest strengths of the Firefox web browser is its add-on engine. The following lists add-ons that add new options and functionality to the browser's cookies management.
- Ghostery - Displays tracking cookies with options to block them in the browser.
- Add & Edit Cookies+ - Adds functionality to analyse the contents of cookies.
Cookie Monster- Adds temporary cookies to Firefox, better cookie management and other interesting options.
Firefox can be configured to keep cookies from select websites and delete all other cookies on exit. The initial configuration takes some time and that is probably what keeps most users from configuring Firefox this way.
Update: The Firefox cookie whitelist option is not preventing cookies from being deleted after all. To protect cookies from being deleted, you need to use an add-on like Cookie Quick ManagerÂ which you can use for that purpose.
Saving cookies like you describe does not work for me. I’ve never been able to get Firefox to save specific cookies where it will prevent me from having to login after I close the browser.
I followed your directions explicitly in both 3.6.15 and 4 beta 12 and neither was able to save any cookies. Not sure why I’ve never been able to get this to work. I’ve tried for months.
Maybe it is an add-on that is interfering with the settings?
Hey Jason, I had the same problem till today. I still have some pages that I couldn’t manage to get working. But at least this helped for *some* pages. I hope it helps you too. And others arriving here.
What is the problem with letting a specific website store cookies? Well it might store the session or part of it in other domains. E. g. netflix.com worked once I whitelisted tho following domains:
Note both http and https and with www and without.
So the best thing is to check the domains used for cookies (Press ctrl + shift + i for the website inspector and there the tab “Storage”) and add all domains used in the cookies in https and http.
I hope this works!
“Accept third party cookies â€“ Third party cookies are cookies that are set by scripts that are loaded on a website. A first party cookie comes on the other hand from the domain the user is on.”
Funny you get it right in the second part of that. Shouldn’t it be “set by scripts that are loaded from _another_ website”?
I always untick “Allow 3rd party cookies”.
I agree that it is clearer, I make the change.
Thankyou, you just let me retire my selectivecookiedelete addon.
Thanks Martin, great post. I use the terrific CookieCuller addon to simplify the process:
Cookies in Firefox are easy to manage, the real problem and threat are Flash cookies.
Is any of this available in Firefox 12.0?
Ghostery and Cookie Monster for use.
This is about Firefox 16.0.2 in November 2012:
The Option #1 to protect cookies from cleaning on exit by adding (domains like google.com or facebook.com) into the “Exception – Cookies” form does not work!
Cookies will be deleted.
The only Firefox solution that works is the Addon “selectivecookiedelete” with a whitelist of the domains with cookies your want to protect from deleting.
As an external solution you can use the Windows programme “CCleaner” with a whitelist of cookies.
Maybe your article is misunderstood
Tried Option #1 (â€œException â€“ Cookiesâ€) with a clean FF 16 without ANY Addons and all the cookies are still deleted.
You are right, I have added an update to the article.
Dear Mr. Brinkmann,
Recently, i ran into the situation that I did not get access to a website unless I fully accepted cookies. Delete after exit was not accepted. Is there any method to mask this setting ? Or else, how can I start a script to remove cookies after firefox has exited ? So any website will not know what I am upto ? (Get access and get rid).
This guide explains how you can configure Firefox to remove cookies on exit, is not that working for you?
As I said before, a combination of
“Accept cookes from sites” = NO – in the privacy settings
plus the addons
“Click & Clean” *
“Cookie Whitelist, with Buttons 2.2” **
“ExExceptions 11.01.11.01” ***
“selectivecookiedelete 4.1” ****
works perfectly for me on FF 19.0 (and probably also later)
* use the option “Clear browsing data when closes” in its preferences if this is best for you
** You will have a button in the top bar so you can easily allow a site to set cookies either “allow” or “allow for session”
*** use “chrome://exexcept/content/exexcept.xul” in address bar for easy settings access for this addon.
**** here you can set the cookies which will not be deleted, please deactivate “clear cookies” in the regular FF settings, let only this addon clear cookies, you probably do not want to be logged out from GMail or Facebook or any Email page.
I found out that i.e. blogger.com and its blogs needs to allow cookies even if you read their pages only. Sorry blogger.com: a pretty dumb solution )I think blogger.com is run by Google.
Somhow unacceptable for privacy reasons. A good site should only set cookies for logins or for submitting forms or comments like I do now here.
I was having trouble with this one as well, found the cure though !
in the “Settings for Clearing History” dialog box Site Preferences needs to stay unchecked too, not just cookies ! otherwise the cookie whitelist gets deleted, and thus the cookies on next restart….
works for me, janary 2015 on Firefox 35.0
@cedric Thanks! FireFox 57 stopped working for me until I did what you said. Now it works.
What is the “Flash” cookie danger Debianero spoke of?
Hello, is this still possible? Link in “Update” section doesn’t work. I would like to be able to whitelist some cookies in Firefox for Android.
Thank you, I have updated the article and replaced the link with a working one.
Cookies can generally be classified into good and bad cookies.???