Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
куки
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: куки
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if Chromium1.Initialized then
Chromium1.Browser.Host.RequestContext.GetCookieManager(nil).FlushStore(nil);
Chromium1.CloseBrowser(True);
end;
everything exactly has to wait 10-40 seconds so that the session cookie cache is saved even though the folder shows that it is saved
begin
if Chromium1.Initialized then
Chromium1.Browser.Host.RequestContext.GetCookieManager(nil).FlushStore(nil);
Chromium1.CloseBrowser(True);
end;
everything exactly has to wait 10-40 seconds so that the session cookie cache is saved even though the folder shows that it is saved
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: куки
I'm sorry but as far as I know there's nothing more you can do to store the cookies.
CEF4Delphi is limited by the CEF API at the time. If there's an issue upstream (CEF or Chromium) then we can only report it.
CEF4Delphi is limited by the CEF API at the time. If there's an issue upstream (CEF or Chromium) then we can only report it.
- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: куки
As far as I know, the CEF API only has one way to flush the cookies to the disk using the "FlushStore" procedure.
If that doesn't work then I'm afraid I can't help you.
If that doesn't work then I'm afraid I can't help you.

- salvadordf
- Posts: 4565
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: куки
Please download CEF4Delphi again from GitHub.
There is a new TChromium.FlushCookieStore function to flush the cookies easily.
The MiniBrowser demo shows how to use it asynchronously with the TChromium.OnCookiesFlushed event but if you need to flush the cookies immediately then you can call TChromium.FlushCookieStore(True). In that case the TChromium.OnCookiesFlushed event will not be triggered.
If you need to flush the cookies before closing the MiniBrowser demo then you would have to replace TMiniBrowserFrm.FormCloseQuery with this :
There is a new TChromium.FlushCookieStore function to flush the cookies easily.
The MiniBrowser demo shows how to use it asynchronously with the TChromium.OnCookiesFlushed event but if you need to flush the cookies immediately then you can call TChromium.FlushCookieStore(True). In that case the TChromium.OnCookiesFlushed event will not be triggered.
If you need to flush the cookies before closing the MiniBrowser demo then you would have to replace TMiniBrowserFrm.FormCloseQuery with this :
Code: Select all
procedure TMiniBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := FCanClose;
if not(FClosing) then
begin
Chromium1.FlushCookieStore; // By default it flushes the cookies immediately and you don't need to pass a TRUE parameter.
FClosing := True;
Visible := False;
Chromium1.CloseBrowser(True);
end;
end;