Posted on December 3, 2021

JxBrowser 7.21 has been released! We’ve extended API with new features, added important fixes and improvements.

What’s New

DOM Image Raw Bytes

Find all the images on a web page or a specific image and access its raw bytes using the new com.teamdev.jxbrowser.dom.ImageElement interface:

document.findElementById("image").ifPresent(element -> {
    if (element instanceof ImageElement) {
        ImageElement image = (ImageElement) element;
        Bitmap bitmap = image.contents();
        Size size = bitmap.size();
        byte[] pixels = bitmap.pixels();
    }
});

It’s useful if you need to extract the images from a web page and store them on a local file system, RAM, or database.

DOM CustomEvent Detail

Listen to the custom DOM events and access their payload:

// Listen to the events of the given custom event type.
element.addEventListener(EventType.of("MyEvent"), event -> {
    // The MyEvent event has been received.
    if (event instanceof CustomEvent) {
        CustomEvent customEvent = (CustomEvent) event;
        JsObject payload = customEvent.detail();
    }
}, false);

Quality Enhancements

  • The upload POST data was corrupted because of some extra bytes.
  • Drop data from dataTransfer was lost on macOS.
  • Subfolders were treated as files when selecting a folder in the OpenFolder callback.
  • BrowserView was blank and threw “Failed to get native widget ID” exception in JavaFX.
  • BrowserView was blank and threw “Failed to detect the GTK version” exception in SWT in Linux.
  • Passing null or undefined from JavaScript to Java resulted in IllegalArgumentException.
  • Network events and callbacks didn’t contain sec-ch-ua, sec-ch-ua-mobile, and sec-ch-ua-platform headers when a web page was loaded via Navigation.loadUrl().
  • Chromium unexpectedly released Browser instance when reaching the memory limit. This is unwanted behavior for the library, and we disabled it.

Download

Download JxBrowser 7.21 Get Free 30-day Trial

Go Top