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.

Please use PluginService 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 information about all the installed and available plugins use the following code:

Collection<Plugin> plugins = pluginService.getPlugins();
for (Plugin plugin : plugins) {
    String pluginName = plugin.getName();
    String pluginDescription = plugin.getDescription();
    String version = plugin.getVersion();
}

Filtering Plugins

Every time when a web page needs to access a plugin the AllowPluginCallback is invoked. In this callback you can tell the web page whether the requested plugin is allowed.

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

private static final MimeType APPLICATION_PDF = MimeType.newBuilder()
        .setValue("application/pdf")
        .build();

...

pluginService.set(AllowPluginCallback.class, (params, callback) -> {
    // Get plugin MIME types.
    List<MimeType> pluginMimeTypes = params.getPlugin().getMimeTypesList();
    // Deny all plugins with the "application/pdf" MIME type.
    if (pluginMimeTypes.contains(APPLICATION_PDF)) {
        callback.deny();
    } else {
        callback.allow();
    }
});

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:

Chromium PDF Viewer

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.

Windows and macOS

Download the Adobe PPAPI Flash Player installer for your operating system:

Download Adobe Flash Player

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+.

  1. 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
    
  2. 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/
    
  3. In case you have installed PPAPI Flash at a different location please specify the path to the Flash library using Chromium switchers when constructing an Engine instance:

     Engine engine = Engine.newInstance(EngineOptions.newBuilder()
             .setPpapiFlashPath("/usr/lib/flash/libpepflashplayer.so")
             .setPpapiFlashVersion("20.0.0.270")
             ...
             .build());
    

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.

Widevine

JxBrowser does not support Widevine at the moment. Web services that use Widevine to distribute content, such as Netflix, Amazon Prime, etc., do not work in JxBrowser/Chromium.

Go Top