I created a browser with TChromium. The TChromium is created dynamically. Facebook access (login) At the end of the process, the component is destroyed. The problem occurs when the component is created again He continues with the previous session (login). I need to clean all cache and cookies. (Force Log out)
Below the code I create the component by:
var
Chromium: TChromium;
begin
try
Chromium := TChromium.Create(nil);
Chromium.SetParentComponent(Form1);
Chromium.Align := alClient;
chromium.Browser.MainFrame.LoadUrl('www.facebook.com');
I destroy it and release memory like this:
FreeAndNil(Chromium)
What should I do?
TLama your help was decisive for my project. I am grateful for sharing your experience.
Solved my problem with this code:
hug
DCEF1:
To delete cookies in DCEF1 wrapper there's the
DeleteCookies
function inICefCookieManager
manager interface. However, I've tried the following code to delete all cookies, but it always failed to me:Fortunately, there is another option to delete cookies using this cookie manager. Visit all of them and in the visitor function assign True to the
deleteCookie
output parameter. Be careful with getting cookie manager, it's created the first time you navigate somewhere (theGetGlobalManager
class function is unsafe, it's not properly handled for unexpected result), so be sure you'll use this code after navigation:DCEF3:
In DCEF3 wrapper you can use the following. Credit goes to Eric Santos: