Plugins

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 Plugins to get information about all the available plugins and enable/disable plugins on a web page.

Plugins plugins = profile.plugins();

By default, all plugins are enabled.

Installed Plugins

To get information about all the installed and available plugins use the following code:

plugins.list().forEach(plugin -> {
    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 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:

plugins.set(AllowPluginCallback.class, (params) -> {
    // Get plugin MIME types.
    List<MimeType> pluginMimeTypes = params.plugin().mimeTypes();
    // Deny all plugins with the "application/pdf" MIME type.
    if (pluginMimeTypes.contains(MimeType.of("application/pdf"))) {
        return Response.deny();
    } 
    return Response.allow();
});

PDF Viewer

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.

Here’s how http://www.orimi.com/pdf-test.pdf is displayed:

Chromium PDF Viewer

If you need to download PDF documents instead of displaying them, then you must disable 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.

Here’s how http://www.orimi.com/pdf-test.pdf#toolbar=0 is displayed:

Chromium PDF Viewer No Controls

Disabling PDF Viewer

By default, the built-in PDF Viewer is enabled. In order to disable it, use the following API introduced in 7.9:

plugins.settings().disablePdfViewer();

Adobe Flash

Adobe Flash reached its end-of-life in December 2020. Chromium dropped support for Adobe Flash starting from the 88 version. So, Flash is not supported in JxBrowser 7.13 and higher.

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

Starting from 7.4 version, JxBrowser allows enabling Widevine through the Engine options.

Go Top