Cef4 cookies

Post Reply
Posts: 6
Joined: Sat Dec 08, 2018 7:34 am

Cef4 cookies

Post by Kazann116 » Mon Apr 15, 2019 4:27 pm

Hello everyone, in cef3 there is a code for quickly creating cookies, and why it is impossible to do this in cef4? mb there is a version of this for quick switching cookies in the browser for example, I want to quickly switch between facebook accounts, how do i implement this?
here in cef3 there is this code

CookieManager: ICefCookieManager;
CookiesPath : String;
CookiesPath := ExtractFilePath(Application.ExeName) + ' Cookies/User1';
CookieManager := TCefCookieManagerRef.Global;
CookieManager.SetStoragePath(CookiesPath, TRUE );

User avatar
Posts: 1653
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain

Re: Cef4 cookies

Post by salvadordf » Mon Apr 15, 2019 9:48 pm


The CookieVisitor demo shows how to visit, create and delete cookies.

CEF4Delphi uses the SetStoragePath function too to set the new path to store the cookies :

I've never tried to change the cookie's path of an existing browser. I don't know if the current CEF binaries support that feature but you can always create a new child browser with a different context and a different path for the cookies.

The MDIBrowser demo has the code to create child browsers with different contexts. All you need is to set a different path for the cache and cookies here :

The cache path is the 1st parameter in TCefRequestContextRef.New, and the cookies path is the 4th parameter in Chromium1.CreateBrowser.

Post Reply