JxBrowser supports Chromium plugins. This guide describes how to get the information about all the installed and available Chromium plugins, how to enable or disable a specified plugin on a web page, etc.
JxBrowser inherits Google Chromium Plugin Architecture and supports plugins. JxBrowser provides two rendering modes: heavyweight and lightweight.
In the heavyweight rendering mode all plugins are displayed exactly as in Google Chrome. In lightweight rendering mode, only plugins that support windowless rendering will be displayed properly.
Since JxBrowser 6.4 only PPAPI plugins are supported because Chromium doesn’t support NPAPI plugins in versions 49 and higher.
Installed Plugins
To get information about all the installed and available plugins use the following code:
PluginManager pluginManager = browser.getPluginManager();
List<PluginInfo> pluginsList = pluginManager.getPluginsInfo();
for (PluginInfo plugin : pluginsList) {
System.out.println("Plugin Name: " + plugin.getName());
}
Filtering Plugins
To enable/disable specified plugin register your own PluginFilter
implementation:
pluginManager.setPluginFilter(new PluginFilter() {
@Override
public boolean isPluginAllowed(PluginInfo pluginInfo) {
// Allow only PDF plugin
return pluginInfo.getMimeTypes().contains("application/pdf");
}
});
JxBrowser 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:
Adobe Flash
JxBrowser supports Adobe Flash PPAPI plugin. In order to display Flash content you need to download and install Adobe Flash Player. Flash content is displayed in the windowless
mode, so make sure that the Flash content you display on the web page has the wmode=opaque
attributed.
Please note that Adobe Flash reaches its end-of-life in December 2020. Chromium drops support for Adobe Flash starting from the 88 version. Therefore, as soon as JxBrowser gets upgraded to the Chromium version 88+, Flash will stop working regardless of whether the plugin is installed or not.
The versions of JxBrowser based on Chromium 87 and below will continue to support Flash if the plugin is installed in the system.
Windows and macOS
Download the Adobe PPAPI Flash Player installer for your operating system:
Run the downloaded installer and follow the instructions to install the Adobe PPAPI Flash plugin. JxBrowser will automatically find the installed Flash PPAPI plugin and use it to display Flash content.
Linux
Installation process of PPAPI Flash can vary depending on the Linux distribution. The following instruction describes how to install PPAPI Flash on Ubuntu 12.04+.
Add PPA repository and install the
pepflashplugin-installer
package.sudo add-apt-repository ppa:skunk/pepper-flash sudo apt-get update sudo apt-get install pepflashplugin-installer
Specify the path to the installed PPAPI Flash if necessary. JxBrowser searches PPAPI Flash in the default locations which are different on various Linux distributions. Here is the list of the locations where JxBrowser expects to find PPAPI Flash:
/usr/lib/pepflashplugin-installer/ /usr/lib/pepperflashplugin-nonfree/ /usr/lib/chromium/PepperFlash/ /usr/lib64/chromium/PepperFlash/
In case you have installed PPAPI Flash at a different location please specify the path to the Flash library using the following Chromium switchers:
BrowserPreferences.setChromiumSwitches( “–ppapi-flash-path=/usr/lib/flash/libpepflashplayer.so”, “–ppapi-flash-version=20.0.0.270”); ```
NPAPI Plugins
Starting from version 49 Chromium does not support any of NPAPI plugins including Microsoft Silverlight and Java Applet. Hence, JxBrowser does not support them either.
ActiveX
ActiveX is not supported by Chromium, so JxBrowser does not support it as well.