Delphi中Chrome Chromium、Cef3学习笔记(六)

来源:互联网 发布:java xpath解析html 编辑:程序博客网 时间:2024/06/05 00:32

一.CEF加载网页时空白

  chrm1.Load(‘你的网址’);

出现空白,跟踪进去:

    frm := FBrowser.MainFrame;  //此时为nil ,可改为:

    frm := FBrowser.GetMainFrame;  

其他地方同上;


后续待更新。。

二、CEF程序退出时报错

 {$R *.res}
 
procedure RegisterSchemes(const registrar: ICefSchemeRegistrar);
begin
  registrar.AddCustomScheme('local', True, True, False);
end;


begin
//  CefCache := getEnvironmentVariable('USERPROFILE')+'\GetTBData\cookies\';
  
  CefCache := 'cache';
  CefOnRegisterCustomSchemes := RegisterSchemes;
  CefSingleProcess := False;
  if not CefLoadLibDefault then
    Exit;


//  CefUserAgent := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;';
//  CefUserAgent := 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11';
  Application.Initialize;
  Application.CreateForm(TuMain, uMain);
  Application.Run;
end.
0 0