List icon Contents

Posted on July 20, 2021

JxBrowser 7.17

We are excited to introduce JxBrowser 7.17! This version brings support of the Chromium profiles, JavaScript Promise API, notifications when network connection state is changed, and many improvements and fixes.

Chromium 91

Chromium has been updated to version 91.0.4472.114.

This Chromium version includes several important security fixes, so we recommend that you upgrade to this version.

Some Chromium features have been removed or changed. Check out the migration guide to see what JxBrowser API has been removed and what alternatives you should use instead.

Profiles

In this version we extended the API with functionality that allows managing Chromium profiles. Now, the architecture has the following structure:

JxBrowser Architecture

Each Engine has a default Profile you can access via:

Profile defaultProfile = engine.profiles().defaultProfile();

The following services now belong to Profile, so you can manage cookies, downloads, permissions, plugins, etc. independently for every profile:

  • ZoomLevels
  • Plugins
  • Proxy
  • Network
  • SpellChecker
  • CookieStore
  • HttpCache
  • HttpAuthCache
  • Downloads
  • Permissions

To create a new regular or incognito profile use the following API:

Profiles profiles = engine.profiles();
Profile myProfile = profiles.newProfile("MyProfile");
Profile myIncognitoProfile = profiles.newIncognitoProfile("MyIncognitoProfile");

Every Browser instance has a profile. To create a Browser instance for specific profile use the following way:

Browser browser = profiles.defaultProfile().newBrowser();
...
Profile myProfile = profiles.newProfile("MyProfile");
Browser browser = myProfile.newBrowser();

For the backward-compatibility we didn’t change the Engine interface. It just delegates its calls to the default profile. For example:

Browser browser = engine.newBrowser();
// is equivalent of
Browser browser = engine.profiles().defaultProfile().newBrowser();

and

CookieStore cookieStore = engine.cookieStore();
// is equivalent of
CookieStore cookieStore = engine.profiles().defaultProfile().cookieStore();

If you configure Engine with the user data directory, then all created profiles will be restored after application restart unless you delete a profile via Profiles.delete(Profile).

Please note that the default profile cannot be deleted.

JS Promises

Our automatic type conversion from JavaScript to Java types and vice versa has been extended with support of JavaScript Promise. Now, you can work with JavaScript Promises through the brand new JsPromise type.

JsPromise promise = frame.executeJavaScript(
        "new Promise(function(resolve, reject) {\n"
                + "    setTimeout(function() {\n"
                + "        resolve('Hello Java!');\n"
                + "    }, 2000);"
                + "})");
promise.then(results -> {
    System.out.println(results[0]);
    return promise;
}).then(results -> {
    System.out.println(results[0]);
    return promise;
}).catchError(errors -> {
    System.out.println(errors[0]);
    return promise;
});

Network connection state

Chromium internally tracks the Internet connection status. When the Internet connection is dropped and then restored, Chromium detects this and programmatically reloads the currently loaded web page. In this version we extend the API with this functionality. Now you can get notifications when the network connection state is changed. For example:

network.on(NetworkChanged.class, e -> {
    // If the connection type is TYPE_NONE, there is no connection.
    if (e.connectionType() == ConnectionType.TYPE_NONE) {
        // The network connection has been dropped. We are offline.
    } else {
        // The network connection has been restored.
    }
});

Enhancements

  • The NavigationFinished event has been extended with isFragmentNavigation() that indicates whether navigation has been performed to a fragment within the same document.

Fixed issues

  • The native Chromium window is detached when JavaFX BrowserView is embedded into TabPane and Stage is restored after minimize on Linux in the hardware accelerated rendering mode.
  • Chromium crash when closing Browser after using the set Desktop Affinity API.
  • Browser steals the input focus when Java window is displayed on Linux in the hardware accelerated rendering mode.
  • An attempt to execute UI-related methods in the popup browser opened by Frame.viewSource() causes a native crash on Windows.
  • The missing drop data from the D&D inside a web page displayed in Swing BrowserView on macOS.
  • Support custom text representations in Swing D&D functionality in the off-screen rendering mode.

Download JxBrowser 7.17

Please share your email with us, and we'll send you download instructions.

Sending...
Please check your inbox.

We were unable to send the email. Please use the direct link to download JxBrowser.

If you are a registered customer you don't need to do anything to use this update.

If you would like to evaluate the product, you need an evaluation license.

Get free 30-day trial