CEFSharp – The best .NET / WPF web browser control, no contest I say!

CEFSharp is a port to .NET (and to WPF as well) of the Chromium Embedded Framework by Per Lundberg.

Per Lundberg

The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications. It is a BSD-licensed open source project founded by Marshall Greenblatt in 2008 and based on the Google Chromium project.

I am astonished at how well done it is actually. I have wrangled with a few others out there in my attempt to have a good browser for the WPF apps I create, but I have always ended up chopping down the scope of how the browser helped the app, and gone with the WPF WebBrowser control, because the others I have tried were a real pain to implement and use. Not so with CEFSharp. I was amazed at how quickly I was using it in an application and painlessly bending and folding it to my particular needs! I already have a growing list of at least 3 applications I will put it to use in…finally…wow. What seemed insurmountable is suddenyl possible…thanks Per! Really, thanks!

Major kudos go to Per Lundberg and the contributors on this project. I think they’ve done a great service to the .NET/WPF community, and I hope they receive all the attention and compensation they deserve for putting this out there on Guthib for all to download and debug-through.

May He bless the work of your hands Per!

8 thoughts on “CEFSharp – The best .NET / WPF web browser control, no contest I say!

  1. I have problems installing it. I tried Nuget command line and Nuget package manager with VS2015. I tried sample code with old versions. No luck. Is there a bunch of dll files I could just copy? Thx.

  2. Hi rajeev, I extract the HTML of the page using WebView.EvaluateScript:


    // first initialize WebView
    // and then use its EvaluateScript method
    // to grab the html using JavaScript.

    string html = wv.EvaluateScript(“document.getElementsByTagName(‘html’)[0].innerHTML”).ToString();

  3. I have used version version 3.29.0-pre0 and after some troubles it worked in a 64 bit wpf application.

    After installing the latest stable version CefSharp.Wpf 33.0.0 I can get it compiled but the it doen’t show the web pages any more.

    I have tried several examples but they all crash or do not compile. The minimal example also crash.

    I noticed that methods wher gone or renamed so how do I get it to work again. Is the (programming)interface goeing to be changed again in the future or is it now stable?

    currently my code is this:

    var settings = new CefSharp.CefSettings
    {
    PackLoadingDisabled = true
    };
    if (CefSharp.Cef.Initialize(settings))
    {
    if (CefSharp.Cef.IsInitialized == true)
    {
    webView = new CefSharp.Wpf.ChromiumWebBrowser();
    webView.AllowDrop = true;
    IEBrowser.Children.Add(webView);
    webView.Address = “http://www.google.nl”;
    }
    }

    and when i need to show a page the code is like this:
    if (webView.IsBrowserInitialized)
    {
    webView.Load(Utils.ConvertCharArrayToString(psIO.sIPAdress));
    }
    As mentioned, in th previouse release this worked (take in account that ChromiumWebBrowser was WebView and I didn’t used IsBrowserInitialized)

  4. Hello. Sorry I did not see this sooner. Had a long vacation 🙂
    If you are still in need of an answer, please leave another comment, I’ll see it sooner this time!
    Thanks again.
    – Dylansweb

  5. Great article. I have a few question 🙂

    – Is CEFSharp based on CEF3?
    – What version of the Chrome Browser is it equivalent to in terms of support for things such as flexbox
    – do you guys offer professional services if we wanted to get going with this technology?

    Thanks

  6. Thanks for the feedback Per. Thanks also for the mention of the other contributors. I will be sure to include a credit to them in the post as well. I am now developing an application that uses CEFSharp to provide myself with an alternative to paying the rather expensive licensing fee for the iMacros scripting edition. For over a year now, I have used the iMacros scripting engine to accomplish many data scraping tasks that are difficult, if not impossible without something like iMacros. That is, without a script-able browser component, which is sometimes required when simply getting the web response from a host is not good enough. Now that I have started using CEFSharp, it seems I may be able to have my cake and eat it too! If you know of any other such developments using CEFSharp, I’d love to hear about it.

  7. Hehe Dylan, thanks a lot! May He truly! 🙂

    I cannot take full credit for the project though; @chillitom and @ataranto have done a great work. I’ve basically just continued the work that they have started, and doing a bit of cleanup as I’ve seen fit. So, you could update the post(s) a bit to include their names also, since they deserve it. 🙂

    Anyway, thanks a lot for your incredibly positive feedback! God bless.

Leave a Reply

Your email address will not be published.