Answer the question
In order to leave comments, you need to log in
How to properly use the Chromium component in Delphi?
Good afternoon!
Installed the Chromium component for Delphi.
Works fast, but there was a problem with saving Cookies.
According to the instructions on the site parsing-and-i.blogspot.ru/2013/01/tchromium-cookie... I
used the code from the example on the button's OnClick event:
procedure TDeliveryForm.sBitBtn1Click(Sender: TObject);
var
CookieManager: ICefCookieManager;
CookiesPath : String;
begin
CookiesPath := ExtractFilePath(Application.ExeName) + DefaultCookiesDir + 'Ddelivery';
CookieManager := TCefCookieManagerRef.Global(nil);
CookieManager.SetStoragePath(CookiesPath, True, nil);
Chromium1.Load('https://cabinet.ddelivery.ru/');
end;
Answer the question
In order to leave comments, you need to log in
Well, I actually figured it out..
procedure TDeliveryForm.sBitBtn1Click(Sender: TObject);
var
CookieManager: ICefCookieManager;
CookiesPath : String;
CefBack: ICefCompletionCallback;
begin
CookiesPath := ExtractFilePath(Application.ExeName) + DefaultCookiesDir + 'Site1'; // Задаем путь к "печенькам"
// ForceDirectoriesUTF8(CookiesPath); // если пути нет то создаем его
CookieManager := TCefCookieManagerRef.Global(CefBack); // подключаемся к менеджеру печенек
CookieManager.SetStoragePath(CookiesPath, True, CefBack); // устанавливаем путь к хранилищу "печенек"
Chromium1.Load('https://cabinet.SITE.ru/user'); // загрузка страницы
end;
For CEF3, the cookie file can be set with the code
procedure TForm1.Button1Click(Sender: TObject);
var
CookieManager: ICefCookieManager;
CookiesPath: String;
begin
CookiesPath:= ExtractFilePath(Application.ExeName) + 'dirForCookie1\';//DefaultCookiesDir
CookieManager:= TCefCookieManagerRef.Global(nil);
CookieManager.SetStoragePath(CookiesPath,False,nil);
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question