我需要在C++应用程序中嵌入web浏览器。此外,我还需要从Delphi组件访问它的javascript方法。
我知道对于FF,有带XPCOM的Gecko。WebKit也有类似的东西吗?
发布于 2010-08-22 15:28:22
首先是WebKit :有一个项目叫做Chromium embedded (Chromium基本上是WebKit渲染引擎和V8 Javascript引擎),它也有Delphi support。在快速查看了头部之后,我没有找到访问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-22 15:13:19
您可以看看this project,它允许您在Delphi应用程序中嵌入chromium浏览器。
https://stackoverflow.com/questions/3540528
复制相似问题