Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Options for embedding Chromium instead of IE WebBrowser control with WPF/C#

Updated for 2020, I've linked my article where I compare the memory footprints of different approaches to hosting HTML WebView in a basic Windows Desktop application:

  • MSEdge WebView2 WPF
  • Chromely/CefSharp
  • Electron v10
  • Legacy IE11 WebBrowser WPF.

Internet Explorer-based WPF WebBrowser control suffers from some keyboard and focus issues and memory leak issues. As an alternative solution to these problems, we're considering available options for hosting Chromium instead of WebBrowser control in our WPF/C# project based around HTML editing. Similar questions have been asked here previously. I've read the answers and done my own research, but I hope to obtain some more feedback from people who have actually used any of the following options in production-quality projects:

Awesomium and Awesomium.NET

It looks very appropriate, but I don't like the fact the project is not open-source and the full source is not easily available. Also, it might be an overkill for our project, as off-screen rendering is not something we really depend on.

Chromium Embedded Framework (CEF) and .NET bindings for CEF

This is probably the best option currently available. The project seems to be alive and active, being currently in sync with Chrome v27. CEF3 uses Chrome multi-process architecture. It also looks like Adobe is giving it some endorsement.

Google's Chrome Frame

While the original purpose of it was to be an HTML5 plugin for IE and Firefox, it actually works as standalone ActiveX control too, so I could wrap it for use with WPF. It exposes a sufficient API for interaction with the inner web page (onmessage, addEventListener/removeEventListener, postMessage). I'm aware Google is to discontinue Chrome Frame, but I assume the sources will remain in Chromium repository. It should not be difficult to update it with the latest Chromium code as we go, and we would have full control over this.

WebKit .NET wrapper

Not exactly Chromium-based and doesn't use V8 engine, so it is not really an option.

Is there any other option I might have overlooked?

I would greatly appreciate if someone shared her/his experience with any of the above options for a real-life, production-quality WPF project. Did you have any integration, licensing, or deployment implications?

like image 729
noseratio Avatar asked Aug 08 '13 06:08

noseratio


People also ask

What browser does WPF use?

A WPF Browser application is an app that runs in-browser as an XBAP (Xaml Browser Application). You can find a little more information on the uses and reasons to use XBAPs here. This thread on MSDN might help also. Show activity on this post.

Is CefSharp free?

CefSharp is BSD licensed, which means that it can be used for proprietary and free/open source applications.

What is CefGlue?

ChromiumEmbedded. CefGlue is a . NET binding for The Chromium Embedded Framework (CEF) by Marshall A. Greenblatt.


1 Answers

You've already listed the most notable solutions for embedding Chromium (CEF, Chrome Frame, Awesomium). There aren't any more projects that matter.

There is still the Berkelium project (see Berkelium Sharp and Berkelium Managed), but it emebeds an old version of Chromium.

CEF is your best bet - it's fully open source and frequently updated. It's the only option that allows you to embed the latest version of Chromium. Now that Per Lundberg is actively working on porting CEF 3 to CefSharp, this is the best option for the future. There is also Xilium.CefGlue, but this one provides a low level API for CEF, it binds to the C API of CEF. CefSharp on the other hand binds to the C++ API of CEF.

Adobe is not the only major player using CEF, see other notable applications using CEF on the CEF wikipedia page.

Updating Chrome Frame is pointless since the project has been retired.

like image 111
Czarek Tomczak Avatar answered Oct 12 '22 22:10

Czarek Tomczak