delphi - Clear Cookies in TChromium -
how clear cookies in cef3.1547 have tried following solution nothing. cookies still present. there better solution this?
procedure tform1.button1click(sender: tobject); var cookiemanager: icefcookiemanager; begin // login 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 domain ' + domain + ' unmercifully ' + 'deleted!'); end ); // visit site again see if cookies cleared.. end;
use code delete cookies chromium version cef3:
use c_wb_clearcookies deleating cookies
use c_wb_clear_url_cookies deleating cookies 1 speceally url -> c_wb_clear_url_cookies('http://google.com','cookie_name');
type ceftask = class(tceftaskown) procedure execute; override; public var url,cookiename: ustring; constructor create; virtual; end; constructor ceftask.create; begin inherited create; url := ''; cookiename := ''; end; procedure ceftask.execute; var cookiemanager: icefcookiemanager; begin cookiemanager := tcefcookiemanagerref.global; cookiemanager.deletecookies(url,cookiename); end; procedure c_wb_clearcookies; var task: ceftask; begin task := ceftask.create; cefposttask(tid_io, task); end; // c_wb_clear_url_cookies('http://google.com','cookie_name'); procedure c_wb_clear_url_cookies(c_url,c_cookiename: ustring); var task: ceftask; begin task := ceftask.create; task.url := c_url; task.cookiename := c_cookiename; cefposttask(tid_io, task); end;
for list cookies cookiename use procedure list_all_cookies
procedure pausek; var m: tmsg; begin while peekmessage(m, 0, 0, 0, pm_remove) begin translatemessage(m); dispatchmessage(m); end; end; procedure pause(i:longint); var j : nativeint; begin j := 1 begin pausek; sleep(100); end; end; procedure list_all_cookies; var cookiemanager: icefcookiemanager; cookie_list : string; const lf = chr(13) + chr(10); begin cookie_list := ''; 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 cookie_list := cookie_list + inttostr(count) + ': ' + domain + ' - ' + name + ' - ' + value + ' - ' + path + lf; if (count<total) result := true; end ); pause(10); showmessage(cookie_list); end;
Comments
Post a Comment