Note: Advice in this article will only work for DotNetBrowser 1.
See the corresponding article for DotNetBrowser 2 here.
To get information about all installed and available plugins you can use the PluginManager.GetPluginsInfo() method:
С#
PluginManager pluginManager = browser.PluginManager; foreach (PluginInfo pluginInfo in pluginManager.GetPluginsInfo()) { Console.WriteLine("Plugin name: " + pluginInfo.Name); }
VB.NET
Dim pluginManager As PluginManager= browser.PluginManager For Each pluginInfo As PluginInfo In pluginManager.GetPluginsInfo() Console.WriteLine("Plugin name: " + pluginInfo.Name) Next
To enable/disable a specific plugin you should register your own PluginFilter implementation:
C#
class CustomPluginFilter : PluginFilter { public bool IsPluginAllowed(PluginInfo pluginInfo) { return pluginInfo.MimeTypes.Contains("application/pdf"); } }
pluginManager.PluginFilter = new CustomPluginFilter();
VB.NET
Class CustomPluginFilter Implements PluginFilter Public Function IsPluginAllowed(pluginInfo As PluginInfo) As Boolean Implements PluginFilter.IsPluginAllowed Return pluginInfo.MimeTypes.Contains("application/pdf") End Function End Class
pluginManager.PluginFilter = New CustomPluginFilter()
The IsPluginAllowed() method is invoked during loading a web page when this web page checks whether a specific plugin is allowed or not. When an exception is thrown from this method, the default behavior will be used, and the plugin will be allowed. The IsPluginAllowed() does not prevent loading the plugin into Chromium.
The sample plugin filter above disables the PDF viewer built-in plugin. As a result, DotNetBrowser will download PDF files instead of opening them in the viewer.