views:

180

answers:

2

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?

+2  A: 

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

Darin Dimitrov
+7  A: 

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
Good to know that the 'delphi chromium embedded' project!
Edwin