I'm quite new to Java and JavaFX and as such I think I'm a bit out of my depth.
I've got a basic application at the moment that houses two WebViews view1
and view2
, each using a separate WebEngine engine1
and engine2
. What I'd hoped was that by using different WebEngines I would be given separate sessions between them, not shared.
Put simply, I'd like to log into the same domain with two different accounts in one Window.
I've had a play with java.net.CookieManager
and java.net.CookieHandler
but I don't quite think I'm barking up the right tree with those.
As far as I can find in the JavaFX documentation I can seem to find any sort of Web Session Provider / Handler like there is in some tools like Awesomium/Visual Studio. I'm hoping someone can either tell me the right place to look for such a class or possibly help me to make one.
Application code is as follows, all help is much appreciated
public void start(Stage primaryStage) {
//Create a GridPane for browser panes
GridPane browserGrid = new GridPane();
browserGrid.setGridLinesVisible(true);
browserGrid.setPrefSize(primaryStage.getWidth(), primaryStage.getHeight());
browserGrid.setHgap(10);
browserGrid.setVgap(10);
browserGrid.setPadding(new Insets(0, 10, 0, 10));
java.net.CookieManager manager1 = new java.net.CookieManager();
java.net.CookieHandler.setDefault(manager1);
WebView view1 = new WebView();
WebEngine engine1 = view1.getEngine();
WebView view2 = new WebView();
WebEngine engine2 = view2.getEngine();
engine1.load("https://www.facebook.com");
engine2.load("https://www.facebook.com");
browserGrid.add(view1, 0, 1);
browserGrid.add(view2, 1, 1);
//playerGrid.setGridLinesVisible(true);
Scene scene = new Scene(browserGrid, 1600, 800);
primaryStage.setTitle("MultiPane Browser");
primaryStage.setScene(scene);
primaryStage.show();
}
Just using Facebook as the default site to log in to for the sake of testing