在Chromium Embedded 3(DCEF3)(CefVCL)中更改用户代理 [英] Changing the user agent in Chromium Embedded 3 (DCEF3) (CefVCL)

查看:119
本文介绍了在Chromium Embedded 3(DCEF3)(CefVCL)中更改用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修改TChromium的用户代理,并且在使用CefVCL的情况下,我没有发现任何程序。已经由ceflib看起来必须这样做了,我看到一个变量 settings接收到一个值 user_agent,但是VCL已经拥有了,这种方式是否可行?

I'm trying to modify the User Agent of TChromium and I found no procedure for this, in case it is using CefVCL. Already by ceflib looks like it has to yes, I saw a variable "settings" that receives a value "user_agent" but the VCL already has, will have or is not possible this way?

推荐答案

不是完整的更改,但对我有用。

Not full change, but it work for me.

procedure TForm1.Chromium1BeforeResourceLoad(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  const request: ICefRequest; const callback: ICefRequestCallback; out
  Result: TCefReturnValue);

Var
  map: ICefStringMultimap;
begin
    map := TCefStringMultimapOwn.Create;
    request.GetHeaderMap(map);
    map.Append('User-Agent','Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16');
    request.SetHeaderMap(map);
    callback.Cont(true);
end;

这篇关于在Chromium Embedded 3(DCEF3)(CefVCL)中更改用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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