Join the Stack Overflow Community
 
Stack Overflow is a community of 6.3 million programmers, just like you, helping each other. 
Join them; it only takes a minute: 
Sign up

I'm using Delphi Chromium Embedded in my application. I should need to save user's account info in a cookie. I know there's CefCookieManager to do it, but i'm not able to find the right procedure to store and to get cookie's value.

shareimprove this question
 
    
Cookies are not meant for client-side manipulation. It's simply something the server stores on your machine. However I could be wrong with your scenario. – Jerry Dodge Apr 18 '13 at 15:16
    
But in Chrome my web application saves login cookie by instruction 'document.cookie'. I should need to do the same thing in Delphi Chromium Embedded. – henry60 Apr 18 '13 at 15:25
    
@JerryDodge - CefCookieManager is exactly exists to client-side manipulation of cookies. – fddima Apr 18 '13 at 15:36
    
@henry60, GetCookie, SetCookie methods on CefCookieManager class. Read documentation carefully, SetCookie method can be called only on CEF IO thread. And setup cookie rightly. After you do it, loaded page will see cookies, provided by cookie manager. – fddima Apr 18 '13 at 15:38
    
Ok, but there's no GetCookie method in CefCookieManager. – henry60 Apr 18 '13 at 15:51 
Uses 
  ceflib;


const
DefaultCookiesDir = 'Cookies/';

implementation
{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var
  CookieManager: ICefCookieManager;
  CookiesPath : String;
begin
  CookiesPath := ExtractFilePath(Application.ExeName) + DefaultCookiesDir + 'User1';
  CookieManager := TCefCookieManagerRef.GetGlobalManager;
  CookieManager.SetStoragePath(CookiesPath);
  Chromium1.Load('www.vk.com');
end;
shareimprove this answer
 
1  
Welcome to SO! When you post an answer here, please post an explanation explaining why your code works. – ElectronicGeek May 18 '14 at 15:59

Your Answer