Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version of WebKit in JavaFX 8 WebView

Tags:

What is the version of WebKit in JavaFX 8?

like image 409
Mukesh Kumar Avatar asked Apr 22 '14 08:04

Mukesh Kumar


People also ask

What is JavaFX WebView?

WebView is a Node that manages a WebEngine and displays its content. The associated WebEngine is created automatically at construction time and cannot be changed afterwards. WebView handles mouse and some keyboard events, and manages scrolling automatically, so there's no need to put it into a ScrollPane .

How do I display JavaFX in my browser?

The recommended way to embed a JavaFX application into a web page or launch it from inside a web browser is to use the Deployment Toolkit library. The Deployment Toolkit provides a JavaScript API to simplify web deployment of JavaFX applications and improve the end user experience with getting the application to start.

What is JavaFX used for?

JavaFX is a set of graphics and media packages that enables developers to design, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms.


1 Answers

You can determine the base version of WebKit being used in WebView by querying the user agent string of the WebView's engine.

web.getEngine().getUserAgent()

This shows a WebKit version of 537.44 for Java 8u5.

This is the upstream version of WebKit used in the JavaFX implementation before any downstream modifications were made to it to allow it to work with JavaFX.

As new versions of Java 8 are released, the version of WebKit used in each version will change, but you should always be able to determine what is used by querying the User Agent String.

Sample Code Output (on my machine)

Java Version:   1.8.0_05-b13
JavaFX Version: 8.0.5-b13
OS:             Windows 7, amd64
User Agent:     Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.44 (KHTML, like Gecko) JavaFX/8.0 Safari/537.44

Sample Code

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebViewVersion extends Application {
    @Override public void start(Stage stage) {
        WebView web = new WebView();
        System.out.println(
                "Java Version:   " + System.getProperty("java.runtime.version")
        );
        System.out.println(
                "JavaFX Version: " + System.getProperty("javafx.runtime.version")
        );
        System.out.println(
                "OS:             " + System.getProperty("os.name") + ", " 
                                   + System.getProperty("os.arch")
        );
        System.out.println(
                "User Agent:     " + web.getEngine().getUserAgent()
        );
        Platform.exit();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
like image 114
jewelsea Avatar answered Sep 19 '22 08:09

jewelsea