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.
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:
Here are explanations for what each setting does:
Tip: Extensions may need cookies as well. Check out this guide to find out how to deal with those.
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.
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.
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 (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.