JavaFX WebView(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.(Oracle创建了JavaFX WebView组件-它自己的开源WebKit引擎包装器。默认情况下,WebKit不支持网页渲染。为了呈现和显示HTML内容,Oracle必须使用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. (这种方法的缺点之一是某些现代网页可能无法在WebView中正确显示,因为提到的渲染器并不总是支持最新的网络标准和CSS / JavaScript / HTML框架。)


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.(为了与最新的Web标准保持一致,渲染器实现必须经常更新。由于迁移到最新的WebKit引擎的复杂性,显然需要进行大量的回归测试,采用引擎中的API更改等,因此频繁更新的任务变得很费力。也许这就是为什么JavaFX中的WebView多年未更新的原因。)


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.(对于任何应用程序,要考虑的另一个重要方面是稳定性和用户数据安全性。为了与WebKit引擎集成,JavaFX WebView使用本机库,该库在Java进程中加载​​。这意味着所有本机代码都使用其内存在Java进程中运行。因此,WebKit引擎中的任何意外行为,异常或错误都将导致Java应用程序本机崩溃,从而可能导致用户数据丢失和业务流程中断。)


JxBrowser(Jx浏览器)

In a few paragraphs below we summarise what mainly differentiates JxBrowser as a solution for your Java app from JavaFX WebView.(在下面的几段中,我们总结了JxBrowser作为Java应用程序解决方案与JavaFX WebView的主要区别。)


Up-to Date Rendering of Web Content(Web内容的最新呈现)

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. (与JavaFX不同,JxBrowser基于Chromium引擎,该引擎也基于WebKit,但是提供了自己的渲染器实现。使用Chromium引擎,JxBrowser不必使用Java Graphics 2D API呈现网页。 Chromium引擎呈现网页,将其留给JxBrowser来显示生成的图像。结果,该网页看起来与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.(Chromium项目正在积极开发中,支持最新的Web标准,因此,使用JxBrowser,开发人员可以确保使用最新Web技术构建的网页上的内容能够正确显示。)


Better Stability of Java Application(Java应用程序更好的稳定性)

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.(JxBrowser继承了Chromium多进程体系结构,因此每个Browser实例都在各自独立的本机进程中运行。如果网页或网页上的插件崩溃,则Java进程将继续工作。 JxBrowser实现几乎将Java进程中的所有本机功能排除在外,仅保留访问共享内存以读取网页渲染结果的功能。这种方法允许工程师在对稳定性有很高要求的软件中使用JxBrowser。)


More Web Browser Capabilities for a Java Application(Java应用程序的更多Web浏览器功能)

JxBrowser API provides many more features comparing to JavaFX WebView API. To name just a few of the popular:(与JavaFX WebView API相比,JxBrowser API提供了更多功能。仅举几个受欢迎的例子:)

  • Intercepting HTTP request/response headers,(拦截HTTP请求/响应标头,)
  • Handling SSL Certificates and errors,(处理SSL证书和错误,)
  • Proxy, Basic, Digest, and NTLM authentication,(代理,基本,摘要和NTLM身份验证,)
  • Geolocation,(地理位置,)
  • Flash and PDF Viewer support,(Flash和PDF Viewer支持,)
  • Chromium remote debugging port support, etc.(Chromium远程调试端口支持等)