3

我需要在 C++ 应用程序中嵌入 Web 浏览器。同样,我需要从 Delphi 组件中获取它的 javascript 方法。

我知道FF有Gecko和XPCOM。WebKit 有这样的东西吗?

4

2 回答 2

7

WebKit 首先:有一个名为 Chromium Embedded 的项目(Chromium 基本上是 WebKit 渲染引擎和 V8 Javascript 引擎),它也支持 Delphi。快速查看标题后,我没有找到访问 JS 方法的方法,但它允许在给定帧中执行 javascript 片段:

// 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;

所以碎片就在那里,你只需要弄清楚如何将它们拼凑在一起。

对于 Gecko,在一个名为d-gecko的项目下可以使用 Delphi 绑定。但它似乎有点过时了,而且似乎也不允许访问 Javascript。

于 2010-08-22T07:28:22.400 回答
2

你可以看看这个项目,它允许你在 Delphi 应用程序中嵌入 Chromium Web 浏览器。

于 2010-08-22T07:13:19.010 回答