【发布时间】:2016-03-11 23:51:40
【问题描述】:
如何清除 CEF3.1547 中的 cookie 我尝试了以下解决方案,但这根本没有任何作用。 Cookie 仍然存在。还有比这更好的解决方案吗?
procedure TForm1.Button1Click(Sender: TObject);
var
CookieManager: ICefCookieManager;
begin
// login to site
CookieManager := TCefCookieManagerRef.GetGlobalManager;
CookieManager.VisitAllCookiesProc(
function(const name, value, domain, path: ustring; secure, httponly,
hasExpires: Boolean; const creation, lastAccess, expires: TDateTime;
count, total: Integer; out deleteCookie: Boolean): Boolean
begin
deleteCookie := True;
ShowMessage('A cookie from domain ' + domain + ' will be unmercifully ' +
'deleted!');
end
);
// visit the site again to see if cookies cleared..
end;
【问题讨论】:
-
是的。有。 WACEF 中的 cookie 管理器是否支持
DeleteCookies方法?我为 DCEF 1 编写的问题中的代码(that post的日期早于DCEF 3 project was released)。在 DCEF 1DeleteCookies对我不起作用。也许 WACEF 会这样做。 -
欢迎来到 Stack Overflow。有一个更好的方法来问这个问题。与其问有没有更好的解决方案,不如问如何删除cookies。然后,将您的代码作为答案 发布。您无需询问是否有更好的解决方案。如果有,其他人会将其作为另一个答案发布,人们可以投票决定哪个更好。
-
@TLama
delete_cookies出现在 WACEF。 -
然后尝试使用它。您正在寻找更好的解决方案。不是我。我写道
DeleteCookies方法经常让我失败,但它是使用 DCEF 1 的。也许新的DeleteCookies方法可以与您正在使用的包装器一起使用。 -
@TLama 我已经测试过
DeleteCookies,它在 CEF3 / WACEF 中不起作用。你能发布如何在 IOThread 上运行它吗?
标签: delphi tchromium chromium-embedded