如何将 Firefox 嵌入到 GUI 应用程序中?
有没有人曾经将 Firefox Web 浏览器技术嵌入到自己的[非托管] C/C++ GUI 应用程序中,就像 IE 可以作为 COM 对象嵌入一样? (我想在 Linux 上执行此操作,而不是 Windows)。是否有 Firefox 的“更好”替代品?我对任何事情都持开放态度,只要我可以将其与非 GPL 代码一起使用。我的需求是相当基本的;我只需要基本的 HTML 解析和静态本地文件的显示,但如果我能得到的话,我会利用更复杂的技术。我希望能够使用 JavaScript,但没有它我也能过得去。
Has anyone ever embedded the firefox web browser technology in their own [unmanaged] C/C++ GUI application in the same way that IE can be embedded as a COM object? (I would like to do this on Linux, not Windows). Are there "better" alternatives to firefox? I'm open to anything as long as I can use it with non-GPL code. My needs are fairly basic; I only need fundamental HTML parsing and display of static local files, but I'd take advantage of more sophisticated technology, if I can get it. I'd like to be able to use JavaScript, but I can get by without it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
首先您需要区分 HTML 引擎和 JavaScript 引擎。
Firefox 的 HTML 渲染引擎称为 Gecko。这里有一个关于在应用程序中嵌入 Gecko 的指南。
Firefox 的 JavaScript 引擎称为 SpiderMonkey,这里是如何在 C 应用程序中嵌入 SpiderMonkey
First you need to differentiate between HTML engine and JavaScript Engine.
Firefoxs HTML rendering engine is called Gecko. And here is a guide about Embedding Gecko in your application.
Firefoxs JavaScript engine is called SpiderMonkey and here is How to Embed SpiderMonkey in your C application
查看 webkitgtk。它不是 Gecko,而是基于 Webkit。它基本上提供了一个可在 GTK+ 应用程序中使用的 Web 浏览器小部件。如果你想嵌入 Mozilla,Mozilla 存储库的 Mercurial 存储库中有些东西可以让你做到这一点,但我上次检查时似乎并没有得到大力支持。
Check out webkitgtk. It's not Gecko, but Webkit based. It basically provides a web browser widget that can be used in GTK+ applications. If you want to embed mozilla, there are things in the mercurial repositories for Mozilla repository that let you do it, but it didn't seem heavily supported last I checked.
正如 Mozilla 所说
,因此请查看前面提到的 Chromium 嵌入式框架 或 < a href="https://webkit.org/" rel="nofollow noreferrer">WebKit。或者,您可以关注 Mozilla 的新项目 https://servo.org/。
您可以在 是否可以像 WebView 一样在 Windows 窗体中嵌入 Gecko 或 Webkit?
as stated by Mozilla
so have a look on either previous mentioned Chromium Embedded Framework or WebKit. Alternatively, you can follow Mozilla's new project https://servo.org/.
You will find some more up to date information on Is it possible to Embed Gecko or Webkit in a Windows Form just like a WebView?
可以在其他应用程序中使用 Firefox 的某些部分(例如 Gecko 渲染器)。有多种方法可以实现此目的,包括 wxWebConnect,一个用于 wxWidgets。另请参阅 嵌入 Gecko
另一种流行的解决方案是 WebKit。同样,您可以通过多种方式使用它,包括 QtWebKit (Qt 工具包的包装器) )和 webkitgtk (SB 已经提到过)。
It is possible to use parts of Firefox (such as the Gecko renderer) in other apps. There are various approaches to this, including wxWebConnect, a web browser control for wxWidgets. See also Embedding Gecko
Another popular solution is WebKit. Again, there are various ways you can use this, including QtWebKit (a wrapper for the Qt toolkit) and webkitgtk (already mentioned by SB).
请查看 CEF(Chromium 嵌入式框架)。它与 WebKit 非常相似,也内置了 HTML 和 JavaScript 引擎,但具有更好的 WebGL 和 HTML5 Canvas 支持。它是在 BSD 许可证下发布的。
Have a look at CEF (Chromium Embedded Framework). It is very similar to WebKit and it also has built-in HTML and JavaScript engines embedded but has better WebGL and HTML5 Canvas support. It is released under BSD license.