Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

OldCEF4Delphi General Capabilities

Post Reply
Coder
Posts: 2
Joined: Fri Jan 15, 2021 2:49 am

OldCEF4Delphi General Capabilities

Post by Coder »

Hi,

I have worked with CEF in other forms such as CefSharp. However, I'm using OldCEF4Delphi in order to support older Windows versions.

My general question is:
Does OldCEF4Delphi have many of the hooks such as events (page "loaded", ...) and ability to call into web page JavaScript from host code as well as ability for methods in the host code to be called from JavaScript in a web page?

Thank You
User avatar
salvadordf
Posts: 4040
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: OldCEF4Delphi General Capabilities

Post by salvadordf »

Hi,

Yes. Almost all CEF callbacks and interfaces are available in OldCEF4Delphi.

All CEF handlers are created automatically if needed inside the TChromium and TCefApplication classes. The callbacks are transformed into events and the methods are available through TChromium and TCefApplication procedures.

Some TChromium and TCefApplication properties expose other CEF interfaces in case some method is missing or you need to call them in a different way.

Open uCEFChromium.pas and you will see some grouped events with a comment like this :

Code: Select all

      // ICefLoadHandler
      FOnLoadStart                    : TOnLoadStart;
      FOnLoadEnd                      : TOnLoadEnd;
      FOnLoadError                    : TOnLoadError;
      FOnLoadingStateChange           : TOnLoadingStateChange;
Those TChromium events are the CefLoadHandler callbacks in other wrappers.

BTW, TChromiumWindow was only intended for extremely simple browsers. If your application needs to use TChromium events and procedures then use a TChromium + TCEFWindowParent combination as you can see in the SimpleBrowser2 demo.

You can use TChromium.ExecuteJavaScript to execute JS code in the browser. If you need to call native functions from JS then you will need to use a JS extension. Take a look at the JSExtension and JSRTTIExtension demos inside the "demos/Javascript" directory.
Post Reply