JavaFX WebView

Oracle created JavaFX WebView component — its own wrapper for the open source WebKit engine. By default WebKit doesn't support web page rendering. In order to render and display HTML content Oracle had to write its own renderer using Java Graphics 2D API.

One of the disadvantages of this approach is that some modern web pages might not be displayed correctly in WebView because the mentioned renderer does not always support the latest web standards and CSS/JavaScript/HTML frameworks. 

To be up to date with the latest web standards, the renderer implementation must be updated often. Due to complexity of migration to the latest WebKit engine, which obviously would require extensive regression testing, adoption to API changes in the engine, etc., the task of frequents updates becomes effort-consuming. Maybe this is why WebView in JavaFX has not been updated for years.

Another significant aspect to consider for any application, is stability and user data safety. For integration with WebKit engine JavaFX WebView uses native libraries, which are loaded in Java process. It means that all native code is running in Java process using its memory. So, any unexpected behaviour, exception or error in WebKit engine will cause native crash in Java application, which may lead to possible loss of user data and disrupted business processes.


In a few paragraphs below we summarise what mainly differentiates JxBrowser as a solution for your Java app from JavaFX WebView.

Up-to Date Rendering of Web Content

Unlike JavaFX, JxBrowser is based on Chromium engine, which is also based on WebKit, but provides its own renderer implementation. With Chromium engine JxBrowser does not have to render web pages using Java Graphics 2D API. Chromium engine renders web pages, leaving it to JxBrowser to display the generated images. As the result, the web page looks exactly like in Google Chrome. 

Chromium project is being developed actively, supporting the most recent web standards, so by using JxBrowser, developers can be sure that the content on web pages built using latest web technologies will be displayed correctly.

Better Stability of Java Application

JxBrowser inherits Chromium multi-process architecture, so each Browser instance is running in its own separate native process. If a web page or plugin on web page is crashed, Java process continues working. JxBrowser implementation excludes almost all native functionality from Java process and leaves only the functionality that accesses shared memory to read the results of a web page rendering. This approach allows engineers to use JxBrowser in software with high requirements for stability.

More Web Browser Capabilities for a Java Application

JxBrowser API provides many more features comparing to JavaFX WebView API. To name just a few of the popular:

  • Intercepting HTTP request/response headers,
  • Handling SSL Certificates and errors,
  • Proxy, Basic, Digest, and NTLM authentication,
  • Geolocation,
  • Flash and PDF Viewer support,
  • Chromium remote debugging port support, etc.