After the user interacts with a certain element on the page and triggers a change, the functionality of JavaFX scripting stops working.
welcome.html
<div onclick="app.goodbye()">goodbye</div>
farewell.html
<div onclick="app.welcomeBack()">welcome back</div>
JavaApp.class
public class JavaApp{
public void welcomeBack(){
//perform some tasks here
setURL("/welcome.html");
}
public void goodbye(){
//perform some tasks here
setURL("/farewell.html");
}
private void setURL(final String uriString){
Platform.runLater(new Runnable(){
public void run(){
JSObject win = (JSObject) webViewPanel.getWebEngine().executeScript("window");
win.setMember("app", new JavaApp());
webViewPanel.loadURL(Browser.class.getResource(uriString).toExternalForm());
}
});
}
}
What steps should be taken to resolve this issue?