List icon Contents

Posted on October 5, 2017

JxBrowser 6.16

JxBrowser 6.16 features an extended DOM API, the ability to enable and disable form autofill suggestions, and a way to provide a custom HTTP status code. This version also supports two new macOS and Ubuntu platforms.

macOS 10.13 High Sierra

JxBrowser 6.16 now officially supports macOS 10.13 High Sierra. The tests in this OS confirmed all the library’s functions to work as expected.

Ubuntu 17.04 Desktop

We have also added support of Ubuntu 17.04 Desktop. All you need to do to run JxBrowser on Ubuntu 17.04 is to install the missing libgconf-2.so.4 system library required by Chromium 60, which is not installed in Ubuntu 17.04 by default. The Ubuntu package for this library is libgconf-2-4:

sudo apt-get install libgconf-2-4

DOMNode.compareDocumentPosition()

The DOMNode.compareDocumentPosition() method allows you to compare the position of the current node against another node in the DOM tree:

browser.addLoadListener(new LoadAdapter() {
    @Override
    public void onFinishLoadingFrame(FinishLoadingEvent event) {
        if (event.isMainFrame()) {
            DOMDocument document = event.getBrowser().getDocument();
            DOMElement sourceNode = document.findElement(By.id("div1"));
            DOMElement targetNode = document.findElement(By.id("div2"));
            DOMNodePosition targetNodePosition = sourceNode.compareDocumentPosition(targetNode);
            System.out.println(targetNodePosition); // FOLLOWING
        }
    }
});

browser.loadHTML("<html>"
                + "<body>"
                + "<div id='div1'></div>"
                + "<div id='div2'></div>"
                + "</body>"
                + "</html>");

DOMDocument.getBaseURI()

The DOMDocument.getBaseURI() method returns the base URI of the current document:

browser.addLoadListener(new LoadAdapter() {
    @Override
    public void onFinishLoadingFrame(FinishLoadingEvent event) {
        if (event.isMainFrame()) {
            DOMDocument document = event.getBrowser().getDocument();
            String baseURI = document.getBaseURI();
            System.out.println(baseURI); // https://teamdev.com/
        }
    }
});

browser.loadHTML("<html>"
                + "<head>"
                + "<base href='https://teamdev.com/'>"
                + "</head>"
                + "</html>");

Enable/disable form autofill suggestions

Now you can enable/disable showing a popup with form autofill suggestions as simple as:

browser.getContext().getAutofillService().setEnabled(false);

Custom HTTP status code

It is now possible to provide a custom HTTP status code with a response that you return from ProtocolHandler:

URLResponse response = new URLResponse();
response.setStatus(HttpStatus.from(111));

Improvements

  • The documentation for the print options was extended with the information about the settings ignored when printing to PDF.

Fixed issues

  • The issue with the binary files validation when JxBrowser is being run twice at the same time.
  • Native crash on macOS with a case-sensitive file system when using certain locales, e.g. zh_cn.
  • Parsing X509 certificates on macOS.
  • NoClassDefFoundError in an OSGi environment.
  • The issue with updating browser preferences that prevents input events from being fired.

Write us at customer-care@teamdev.com to download JxBrowser 6.16.