JxBrowser 6.14 includes several long-awaited new features such as CSS injection and getting Browser instance that initiated URL request in NetworkDelegate.Apart from extending JxBrowser API with new functionality, this update addresses a lot of fixes and improvements.
Injecting custom style sheet (CSS)
Now you can inject a custom style sheet into every web page loaded in JxBrowser. In order to inject CSS use the Browser.setCustomStyleSheet(String customStyleSheet)method. Once you set a string that represents CSS, all web pages loaded in this Browser instance will be updated with the given CSS. See example to get more details on how to use this functionality.
Injecting custom SSL certificate
TheDialogHandler.onSelectCertificate(CertificatesDialogParams params)method allows selecting SSL certificate from the list of installed certificates. Now, you can tell Chromium engine to use SSL certificate that isn’t installed in your environment. See example.
Accessing Browser in NetworkDelegate events
A lot of developers requested that we provide an ability to associate Browser instance with HTTP request/response. Now you can do that. See the RequestParams.getBrowser()method.
The following functionality got better in v6.14:
Added Chromium profile directory validator. In general, Chromium engine doesn’t allow running several processes or BrowserContext instances configured to the same profile directory. Sharing profile directory between different native processes and BrowserContext instances may lead to unexpected behavior including crashes in Chromium engine. To protect Java application from the unexpected crash in Chromium engine, since 6.14 version JxBrowser checks whether Chromium profile directory is already used by another BrowserContext instance or native process, and throws an exception if Browser instance cannot be configured to use the given profile directory.
Improved Chromium binaries validation. JxBrowser allows configuring the path to the directory where it should find/extract Chromium binaries. If the directory already contained Chromium binaries, then old validator implementation simply checked the existence of the required Chromium files. Now, JxBrowser validates that the Chromium binaries in the directory not only exist but also correspond to the current JxBrowser version. So, the situation when old Chromium binaries are used with new JxBrowser library won’t happen.
Here’s what has been resolved in this update:
The issue when some CSS cursors such as zoom in, zoom out, etc. aren’t supported in heavyweight rendering mode.
Wrong scrolling in SWT-JavaFX applications on macOS.
Wrong cursor location in JavaFX applications with enabled lightweight rendering mode.
The issue when the drop down doesn’t work in JavaFX TabPane with enabled lightweight rendering mode.
Wrong scaling in the multi HiDPI/Non-HiDPI monitor environment on macOS and Windows in both lightweight and heavyweight rendering modes in JavaFX and Swing.
Improved stability in the multi-threaded environment.
Smooth font rendering in heavyweight and lightweight rendering modes on Windows.
Wrong BrowserView location in JavaFX SplitPane in heavyweight rendering mode on Windows.
Memory leak when using JSObject.setProperty().
Native crash when calling JSObject.removeProperty().
The "Go Forward" button in JxBrowser Demo is disabled when should be enabled.
Broken rendering in drop downs in JavaFX and Swing with enabled lightweight rendering mode.
Java 9 isn’t recognized properly. Now you can launch JxBrowser on Java 9 without unexpected environment validator exceptions.
Broken file upload functionality.
File chooser dialog isn’t displayed in IFRAMEs.
Broken JavaFX lightweight rendering with low RAM.
Broken JavaFX lightweight rendering when resizing BrowserView.
Default print dialog allows printing only 100 pages.
The BrowserPreferences.setDefaultEncoding()method should be marked as deprecated because Chromium 55 ignores encoding settings.
Drop down is not closed when moving JavaFX window in heavyweight rendering mode.