Plugins

DotNetBrowser supports Chromium plugins. This guide describes how to get the information about all the installed and available Chromium plugins, enable or disable a specified plugin on a web page, and other actions.

Use IPlugins to get information about all the available plugins and enable/disable plugins on a web page. By default, all plugins are enabled.

Installed plugins

To get the information about all the installed and available plugins, use the code sample below:

foreach (Plugin plugin in engine.Plugins.AvailablePlugins)
{
    string name = plugin.Name;
    string description = plugin.Description;
    string version = plugin.Version;
}

Filtering plugins

Every time when a web page needs to access a plugin, the AllowPluginHandler is used. In this handler, you can instruct the web page whether the requested plugin is allowed.

The following example demonstrates how to deny all plugins with the application/pdf MIME type:

engine.Plugins.AllowPluginHandler = 
    new Handler<AllowPluginParameters, AllowPluginResponse>(p =>
    { 
        // Get plugin MIME types.
        IEnumerable<MimeType> pluginMimeTypes = p.Plugin.MimeTypes;
        // Deny all plugins with the "application/pdf" MIME type.
        if (pluginMimeTypes.Contains(MimeType.ApplicationPdf))
        {
            return AllowPluginResponse.Deny();
        }
        return AllowPluginResponse.Allow();
    });

PDF

DotNetBrowser supports the built-in Chromium PDF Viewer plugin. You can display a PDF file available on a remote web server using URL of the PDF file, or a PDF file located in your local file system:

Chromium PDF Viewer

PDF viewer toolbar

By default, PDF Viewer displays the built-in controls such as zoom buttons, toolbar with the file name, page number, Rotate, Download, and Print buttons. You can hide these controls by adding #toolbar=0 to the end of the URL.

For example, http://www.orimi.com/pdf-test.pdf#toolbar=0

No Toolbar

Disabling PDF viewer

By default, the PDF files will be displayed in the PDF Viewer. To download the PDFs instead of displaying them, use the IBrowserSettings.PdfViewerEnabled property:

engine.Plugins.Settings.PdfViewerEnabled = false;

Adobe Flash

Adobe Flash reaches its end-of-life in December 2020. The versions of DotNetBrowser based on Chromium 87 and below may still work with Flash if the corresponding plugin is installed and configured in the system.

Since version 88, Chromium does not support Flash. DotNetBrowser does not support it as well starting from version 2.5.

NPAPI plugins

Since version 49, Chromium does not support any of NPAPI plugins, including Microsoft Silverlight, DotNetBrowser does not support them as well.

ActiveX

Since ActiveX is not supported by Chromium, DotNetBrowser does not support it as well.

Go Top