Over a million developers have joined DZone.

Chromium Web Browser Control in .NET Applications

· Java Zone

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

Do you need to embed a web browser into your .NET application, but the default MS IE-based WebBrowser component does not satisfy your requirements? Are you looking for an easy-to-use and full-featured alternative? In this case DotNetBrowser  is a good choice for you.

DotNetBrowser is a .NET library that gives you a possibility to embed a Chromium-based browser component into your .NET WPF or WinForms applications to display modern web pages built with HTML5, CSS3, JavaScript.

DotNetBrowser has a great documentation that includes the Quick Start Guide , the Knowledge Base with detailed explanations for all possible use-cases, and the API documentation , where all the components and features are well documented.

In the list of samples  you can find code samples that demonstrate how to perform the most common tasks, such as loading a web page from URL, getting the source code of the displayed page, rendering the given HTML code and executing JavaScript code.
The component’s API is rich and easy to use. For example, let's see how easy you can embed a DotNetBrowser component into your WPF application and navigate on the Google web page:

MainWindow.xaml

<Window x:Class="WPF.DotNetBrowser.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid Name="mainLayout">
    </Grid>
</Window>

MainWindow.xaml.cs

using System;
using System.Windows;
using DotNetBrowser;
using DotNetBrowser.WPF;

namespace WPF.DotNetBrowser
{
    public partial class MainWindow : Window
    {
        BrowserView webView;

        public MainWindow()
        {
            Environment.SetEnvironmentVariable("DOTNETBROWSER_BIN_DIR",
                @"D:\Projects\DotNetBrowser-1.0\Library\Chromium");
            InitializeComponent();

            webView = new WPFBrowserView(BrowserFactory.Create());
            mainLayout.Children.Add((UIElement)webView.GetComponent());
            webView.Browser.LoadURL("http://www.google.com");
        }
    }
}

Once you configure  your .NET Visual Studio 2013 project with DotNetBrowser library and run the application, the result will look like given below:

The functionality of DotNetBrowser is not limited to loading and rendering HTML pages. The product’s API allows listening to the browser events, displaying popups, accessing and modifying DOM, managing and executing JavaScript code and even calling .NET methods from Javascript. 

Such capabilities of DotNetBrowser look very promising for any .NET developer who is interested in a solution of that kind.

Bring the power of Chromium engine into your .NET application!

Links:
About library: http://www.teamdev.com/dotnetbrowser
Samples: https://sites.google.com/a/teamdev.com/dotnetbrowser-support/samples

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

Topics:
java ,dotnet ,enterprise-integration ,.net ,web browser ,wpf ,chromium ,.net c#

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}