I want to call javafx functions from javascript on my HTML. I do the following (and it works correctly):
JSObject win = (JSObject) webEngine.executeScript("window");
win.setMember("app", new MyController(this.webEngine));
URL url = getClass().getResource("page1.html");
this.webEngine.load(url.toExtealForm());
Inside the page1.html i can call functions from MyController with JavaScript using the app object:
app.hello();
Then, in some moment I change the displaying page like this:
URL url = getClass().getResource("page2.html");
this.webEngine.load(url.toExtealForm());
The problem is that in page2.html i can't call any function from MyController. I've tried to recreate the object app (before and after the page change) but it doesn't work.
How can I maintain the interaction within JS and JavaFX?
