How can I programmatically enumerate and delete Edge browser's cookies?
They don't appear to be among the IE cookies in temporary internet files, and therefore seem not to be returned by the FindFirstUrlCacheEntry
/FindNextUrlCacheEntry
API calls.
I can see cookie files in
Cookies are different from your cache or browser history. A web cache is another piece of information that is stored on your computer. Unlike cookies which store your information, cache temporarily stores web documents such as HTML pages. This allows websites you’ve already visited to load quickly and use less bandwidth.
What is the distinction of the three directories? How can they be accessed and individual cookies be deleted programatically?
1 Answer
This isn't going to be a perfect answer, but perfect enemy of good etc.
It seems like Edge still uses at least the first two locations. I don't see any recent cookies in the last one. However, maybe that is just coincidence.
I've tried running several windows and tabs to see if different folders get used by different content processes, but I've not been able to figure out much in that department, either.
What I can tell you is the format of these files: they are '*n'
separated cookie collections. Every cookie has a number of fields, which are 'n'
-separated.
Edit (2015/12/16): Just stumbled across my own answer here again, and I need to note that some of the cookie field values themselves can end with '*'
in which case searching for the '*n'
delimiter will think that the cookie finishes early. No, the values are not escaped (which would make sense...). So your best bet is really to just count the number of lines, which is unfortunate. This was fixed in the first portion of this patch for Firefox, which is present in Firefox 44 and later.
Cookies Where Are They Stored Windows 10
Windows 10 Problems
The cookie fields are documented in Firefox's source code:
The cookie file format is a newline-separated-values with a '*' used as delimeter between multiple records.Each cookie has the following fields:
- name
- value
- host/path
- flags
- List item
- Expiration time most significant integer
- Expiration time least significant integer
- Creation time most significant integer
- Creation time least significant integer
At least, this seems to have been the format in IE, and the format here seems to be so similar that I would be surprised if they were materially different.
I just submitted a patch for using Firefox's existing IE cookie reading code for Edge's cookies, and that seemed to work. Here's the reviewboard review for it, and the revlink in hg.
GijsGijs