Delphi Chromium Embedded - 创建并获取Cookie [英] Delphi Chromium Embedded - Create and get a cookie

查看:2823
本文介绍了Delphi Chromium Embedded - 创建并获取Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用Delphi Chromium Embedded。
我应该需要在cookie中保存用户的帐户信息。
我知道有CefCookieManager来做,但我不能找到正确的过程来存储和获取cookie的值。

I'm using Delphi Chromium Embedded in my application. I should need to save user's account info in a cookie. I know there's CefCookieManager to do it, but i'm not able to find the right procedure to store and to get cookie's value.

推荐答案

Uses 
  ceflib;


const
DefaultCookiesDir = 'Cookies/';

implementation
{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var
  CookieManager: ICefCookieManager;
  CookiesPath : String;
begin
  CookiesPath := ExtractFilePath(Application.ExeName) + DefaultCookiesDir + 'User1';
  CookieManager := TCefCookieManagerRef.GetGlobalManager;
  CookieManager.SetStoragePath(CookiesPath);
  Chromium1.Load('www.vk.com');
end;

这篇关于Delphi Chromium Embedded - 创建并获取Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆