Cookies, small bits of data that Internet servers you connect to can place on your local computer, can be both beneficial and privacy-invasive depending on how they are used. Beneficial cookies store session data so that you can browse a website without having to sign in on every page you visit. Privacy-invasive cookies on the other hand track you on the Internet to create profiles that are used by advertising companies and marketing firms.
A core issue in this regard is that cookies have an expiration data set by the server so that they may reside on the computer even after you have closed the website. While this may be beneficial at times, for instance if you visit the website regularly and do not want to log in every time you do so, it can as well reveal a lot about your surfing habits and be used to track you when you visit a website again.
There are a couple of things you can do to limit the privacy implications. You can for instance disable third party cookies in Firefox which blocks the majority of tracking related cookies from being set on the system.
You can also have Firefox delete all cookies but whitelisted ones on exit which is another interesting option to reduce cookie tracking.
The Firefox add-on Self-Destructing cookies offers another interesting option. The extension removes cookies automatically from the system once you close the website that has set them on your system. This not only deletes tracking cookies regularly during sessions but also makes sure you are logged out of sites automatically which may improve security on multi-user systems.
A whitelist is provided that you can add websites to that you want ignored by the add-on so that its cookies remain on the system even after the website has been closed.
Cookies are deleted automatically after a grace period of 10 seconds, a value that you can change in the options. You receive a notification when cookies are removed.
The extension honors the whitelisting settings of the Firefox browser. To whitelist cookies press Alt, select Tools > Options, switch to privacy and click on the Exceptions button next to cookies.
Add domains, e.g. ghacks.net that you want cookies whitelisted for so that they are not deleted by the extension when you close the website they have been created on during connection.
The settings of Self-Destructing Cookies lists options to disable notifications and to allow 3rd party tracking (which is disabled by default).