As noted above, once the user clicks on something that changes the page, the scripting using JavaFX no longer works.
hello.html
<div onclick="app.byeBye()">bye</div>
byebye.html
<div onclick="app.hello()">hello</div>
JavaApp.class
public class JavaApp{
public void hello(){
//process some stuff here
setURL("/hello.html");
}
public void byeBye(){
//process some stuff here
setURL("/byebye.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 must I do to fix this problem?