如何在 Chromium 中设置或更改 cookie 值?
How to set or change cookie value in Chromium?
如何在 Chromium 中设置或更改 cookie 值?
这行不通:
CookieManager := TCefCookieManagerRef.Global;
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 := False;
ShowMessage(name + ': ' + Value);
CookieManager.SetCookie('', name, Value + 'aaaa', domain, path, secure,
httponly, hasExpires, creation, lastAccess, expires);
Result := True;
end);
SetCookie函数中不能使用空url,根据域添加url即可。
SetCookie('http://=your site=/' ...
一切正常。
此外,还有另一种解决方案,您不必在 VisitAllCookiesProc 中使用
TCefFastTask.New(TID_IO, procedure
begin
CookieManager.SetCookie('http://=your site=/'...
end
);
如何在 Chromium 中设置或更改 cookie 值?
这行不通:
CookieManager := TCefCookieManagerRef.Global;
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 := False;
ShowMessage(name + ': ' + Value);
CookieManager.SetCookie('', name, Value + 'aaaa', domain, path, secure,
httponly, hasExpires, creation, lastAccess, expires);
Result := True;
end);
SetCookie函数中不能使用空url,根据域添加url即可。
SetCookie('http://=your site=/' ...
一切正常。
此外,还有另一种解决方案,您不必在 VisitAllCookiesProc 中使用
TCefFastTask.New(TID_IO, procedure
begin
CookieManager.SetCookie('http://=your site=/'...
end
);