Configure Firefox To Delete All Cookies On Exit But Select Ones - gHacks Tech News

Configure Firefox To Delete All Cookies On Exit But Select Ones

All web browsers accept cookies from all 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 cookies

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 cookies from sites - The setting is enabled by default. It basically enables the use of cookies in the Firefox web browser. Users who disable the option will notice that no cookies are saved from that point on.
  • 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.

firefox clearing history

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.

keep until close

Cookies are now deleted whenever you exit the browser. Now we need to configure cookies that we want to keep.

Option 1

firefox cookie exceptions

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.

Option 2

set cookies

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.

Blocking Cookies

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.

Firefox add-ons

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.

Verdict

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 Selective Cookie Delete which you can use for that purpose.

Summary
Configure Firefox To Delete All Cookies On Exit But Select Ones
Article Name
Configure Firefox To Delete All Cookies On Exit But Select Ones
Description
Find out how to configure the Firefox web browser so that it accepts only cookies from sites that are on a whitelist (and as such explicitly allowed).
Author
Publisher
Ghacks Technology News
Logo
Advertisement

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:


Previous Post: «
Next Post: »

Comments

  1. jason said on March 9, 2011 at 4:35 pm
    Reply

    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.

    1. Martin said on March 9, 2011 at 4:57 pm
      Reply

      Maybe it is an add-on that is interfering with the settings?

  2. Taomyn said on March 9, 2011 at 6:31 pm
    Reply

    “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”.

    1. Martin said on March 9, 2011 at 6:33 pm
      Reply

      I agree that it is clearer, I make the change.

  3. Chip said on March 10, 2011 at 12:02 pm
    Reply

    Thankyou, you just let me retire my selectivecookiedelete addon.

  4. Dotan Cohen said on March 10, 2011 at 2:11 pm
    Reply

    Thanks Martin, great post. I use the terrific CookieCuller addon to simplify the process:
    https://addons.mozilla.org//firefox/addon/cookieculler/

  5. Debianero said on March 13, 2011 at 9:53 pm
    Reply

    Cookies in Firefox are easy to manage, the real problem and threat are Flash cookies.

  6. Brian said on June 2, 2012 at 12:42 pm
    Reply

    Is any of this available in Firefox 12.0?

  7. Martin Brinkmann said on June 2, 2012 at 1:29 pm
    Reply

    Ghostery and Cookie Monster for use.

  8. Thomas Will said on November 7, 2012 at 4:49 pm
    Reply

    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

    1. Thomas Will said on November 7, 2012 at 5:22 pm
      Reply

      Tried Option #1 (“Exception – Cookies”) with a clean FF 16 without ANY Addons and all the cookies are still deleted.

      1. Martin Brinkmann said on November 7, 2012 at 5:49 pm
        Reply

        You are right, I have added an update to the article.

  9. Roel dijkema said on March 11, 2013 at 12:37 pm
    Reply

    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).

    1. Martin Brinkmann said on March 11, 2013 at 1:08 pm
      Reply

      This guide explains how you can configure Firefox to remove cookies on exit, is not that working for you?

  10. Thomas Will said on March 12, 2013 at 12:39 am
    Reply

    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.

  11. cedric said on January 15, 2015 at 1:16 am
    Reply

    Hi

    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

    1. Paul said on January 5, 2018 at 2:23 am
      Reply

      @cedric Thanks! FireFox 57 stopped working for me until I did what you said. Now it works.

  12. rudedog said on December 25, 2015 at 7:57 am
    Reply

    What is the “Flash” cookie danger Debianero spoke of?

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.