Search code examples
javaswingjxbrowser

Does JXBrowser support loading chrome extensions?


I need to allow Windows Accounts chrome extension to be loaded into JXBrowser. Is there a way to achieve that or allow Conditional Access Policy to be supported by JXBrowser?

I use JXBrowser in version 7.35.2.

  1. Use EngineOptions.Builder addSwitch API with --load-extension switch
  2. Use EngineOptions.Builder userDataDir API and point it to directory, in which google chrome stores its data ($home/.config/google-chrome)
  3. Download extension into a launched JXBrowser instance by manually navigating to chrome web store.

What I've expected with each of these approaches is to have Windows Accounts extension installed into chromium. Unfortunately, the extension did not get loaded.


Solution

  • JxBrowser doesn't support extensions at the moment. This feature has been in the roadmap for a long time and, hopefully, will be released this year. We're finishing it up.

    If you are a license holder (a trial license will do), there are preview builds already available. Reach out to the company to get one.

    This particular extension, Windows Accounts, works well. We checked it.

    Here's the an example of the new API:

    // Install the extension from URL or CRX file.
    Extension extension = profile.install(UBLOCK_URL); 
    
    // Work with the extension action (it's like an icon in the extension toolbar in Chrome).
    ExtensionAction action = extension.action(browser);
    
    // Click on the "icon".
    action.click();
    
    browser.set(OpenExtensionActionPopupCallback.class, (params) -> {
      // Allow extension to open a popup after a click on the action.
      return Response.open();
    });