Does JavaFX8 WebEngine's ExecuteScript("window") Method Refer To The JavaScript Window Object?
I'm wondering about this code snippet I'm using: WebView webView = new WebView(); JSObject jsobj; webEngine = webView.getEngine(); try { webEngine.load(getClass().getResource('
Solution 1:
According to this site, webEngine.executeScript("window")
would in fact return the JavaScript Window object. There's also a whole bunch of other code snippet goodies to look!
java
in this case is a handler that can be used by your JavaScript, within the Window object. So your JavaScript, when referencing java
can expect to access the DataModel
object.
Also, you normally want to refresh your page with location.reload()
in JavaScript.
If you're looking to save state between reloads, you'll want to capture the current HTML and then use the WebView's loadContent functionality when the reload is complete. You could also get the WebView's document so you can directly modify nodes at any level.
Post a Comment for "Does JavaFX8 WebEngine's ExecuteScript("window") Method Refer To The JavaScript Window Object?"