How can I embed firefox in a GUI application?

别等时光非礼了梦想. 提交于 2019-11-30 06:30:01

问题


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.


回答1:


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




回答2:


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.




回答3:


as stated by Mozilla

Embedding of Gecko is no longer supported

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?




回答4:


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).




回答5:


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.



来源:https://stackoverflow.com/questions/2611906/how-can-i-embed-firefox-in-a-gui-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!