Why do cookies persist after clicking "Clear Data"?
Hi Mozilla community,
The Developer Tools -> Storage -> Cookies pane shows cookies currently being stored by Firefox.
If I close my browser, these cookies are automatically deleted. However, if I follow the steps on [1], the cookies are still there, and don't get deleted. *Why?*
Thanks in advance!
Steps to reproduce:
- Start a new Firefox session - Open Developer Tools -> Storage -> Cookies and see that the list is empty - Go to youtube.com and click Accept All on the cookies popup - Developer Tools -> Storage -> Cookies now shows a cookie from YouTube, as per the attached screenshot - Go to Settings->Privacy & Security->Cookies and Site Data -> Clear Data -> Clear - Go back to Developer Tools -> Storage -> Cookies and click on the refresh icon - The YouTube cookie is still there - However either of the following actions will correctly delete this cookie:
1) closing firefox (with Always Use Private Browsing Mode enabled) 2) manually deleting the cookie from the list in Developer Tools -> Storage -> Cookies
[1] https://support.mozilla.org/en-US/kb/clear-cookies-and-site-data-firefox
Solution choisie
If you are in permanent Private Browsing mode (Always use Private Browsing mode; Never Remember History) then all session data is stored in memory and purged automatically when you close Firefox, so there is no need to use "Clear history when Firefox closes" and it doesn't have effect. What you see in "Cookies and Site Data -> "Manage Data" is data from the regular session and you can only clear this data in regular mode (i.e. you need to exit PB mode).
Lire cette réponse dans son contexte 👍 2Toutes les réponses (5)
Hi Dropa, thanks very much for the reply.
If I understand correctly, you're saying that the Clear Data button doesn't delete the cookies for websites which are currently being used by Firefox. So if I'm on YouTube and click Clear Data, it doesn't delete the cookie for YouTube. Is that right?
I can delete the cookie while on YouTube by removing it via Developer Tools -> Storage -> Cookies.
So I'm trying to understand why, if the cookie can be deleted from the Developer Tools pane, the Clear Data button doesn't do the same thing. It feels like either I've misunderstood something about how cookies work, or the Clear Data button isn't very well documented, because it doesn't actually clear all the data.
Solution choisie
If you are in permanent Private Browsing mode (Always use Private Browsing mode; Never Remember History) then all session data is stored in memory and purged automatically when you close Firefox, so there is no need to use "Clear history when Firefox closes" and it doesn't have effect. What you see in "Cookies and Site Data -> "Manage Data" is data from the regular session and you can only clear this data in regular mode (i.e. you need to exit PB mode).
Hi cor-el (or is that Clark?!)
Thanks for picking this up and yes this has answered the question.
In case this helps anyone in the future, I will just clarify a little.
It's not the "Clear history when Firefox closes" setting that I'm asking about. Rather, I was confused about why the "Clear Data" button, which refers to cookies, not history, doesn't delete the cookies.
However, cor-el's explanation applies equally to the Clear Data button: When permanent Private Browsing mode is switched off, this button deletes the cookies as expected.
The reason is that the Clear Data button deletes cookies stored on disk. In Private Browsing mode, cookies are held in memory. So the button appears to work, but doesn't actually do anything about the in-memory data.
One of the Firefox devs has clearly thought about this issue and put a little notification in Privacy->Cookies & Site Data explaining that the "Clear history when Firefox closes" setting isn't needed in Private Browsing mode. But the the Clear Data button remains enabled, suggesting that it still works even in Private Browsing mode.
One final note: although, with Private Browsing disabled, the cookies are deleted by the Clear Data button, they are still listed in Developer Tools -> Storage -> Cookies as if they were still there, even after refreshing that pane. That behaviour seems a bit iffy to me, but perhaps there's a reason.
Thanks again cor-el and Dropa for your help!
I think that you should still be able to clear the cookies and other site data kept in memory in current releases, but you won't see this in "Manage Data". I think that the Storage Inspector should reflect this in a better way.
I also agree with the statement, " think that you should still be able to clear the cookies and other site data" when in permanent private browsing. I am NOT knowledgeable in this area, but it doesn't seem logical to add, and maintain, code that forces the user to close the private browser to clear data when that is not required outside private browsing.
There are sites which allow one chance to solve a problem. Outside private browsing, clearing data, allows a replay. In private browsing the browser must be closed and reopened. if, as I do, there are several tabs this forces to reopen all pages.
Also, isn't the data available to other websites and if clearing data doesn't clear data it is seemingly unsafe to visit another website without first closing the browser.