3

I need to embed a web browser in C++ application. As well, I need to reach its javascript methods from Delphi components.

I know that for FF there is Gecko with XPCOM. Is there something like this for WebKit?

Dejell
  • 13,947
  • 40
  • 146
  • 229

2 Answers2

7

WebKit first: there's project called Chromium embedded (Chromium is basically WebKit rendering engine and V8 Javascript engine), that has also Delphi support. After a quick look into headers, I did not find a way to access JS methods, but it allows executing javascript snippets in given frame:

// Execute a string of JavaScript code in this frame. The |script_url|
// parameter is the URL where the script in question can be found, if any. The
// renderer may request this URL to show the developer the source of the
// error.  The |start_line| parameter is the base line number to use for error
// reporting.
execute_java_script: procedure(self: PCefFrame; const jsCode, scriptUrl: PWideChar; startLine: Integer); stdcall;

So the pieces are there, you just need to figure out how to patch them together.

For Gecko, there are Delphi bindings available under a project called d-gecko. But it seems to be a bit outdated and also does not seem to allow accessing the Javascript.

plaes
  • 31,788
  • 11
  • 91
  • 89
2

You may take a look at this project which allows you to embed the chromium web browser in Delphi applications.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928