In a Delphi XE8 VCL Form Aplication, with TEmbeddedWB
I get the cookies with this method:
CookieStr := EmbeddedWB1.Cookie;
CodeSite.Send('CookieStr', CookieStr);
This is the result (for example):
name1=value1; name2=value2; name3=value3
However, as you can see, this gets only the name and value of the cookies.
So how can I get the other cookie fields such as path, expiration date, etc.?
Here is the solution:
First, we need to make us familiar with the Winapi FILETIME structure.
Then get the IE cookie files from here:
Now look for the cookie files with the identical
name=value
pairs you got fromTEmbeddedWB.Cookie
.Here is an example of the content of a IE cookie file, where we take our data from:
(Similarities with people alive or other authorities are purely accidental and not intended!)
We can see the meaning of the various numbers from the red colored comments.
And here is the source code to decipher those numbers:
Now we can use this function with the numbers from the above cookie file, as an example:
Which will give us this result: