Does JavaFX web viewer support loading a web page from a string of html code? My code is currently functional under scenario 1 below. However, I will need to break the webFile up into two pieces (top & bot), and then insert a string of html in between. The final result is loaded via webviewer. Please see #2 for my intent (it doesn't work). Can anyone suggest on how I might be able to pull this off? Thanks!
String webFileStr = (new File(webFile)).toURI().toURL().toString(); webEngine.load(webFileStr);
String webStr = topSlice + data + botSlice; webEngine.load(webStr);
webView.getEngine().loadContent("<html>hello, world</html>", "text/html");
Loads the given content directly. This method is useful when you have content composed in memory, or loaded from some system which cannot be reached via a URL (for example, the SVG text may have come from a database). As with load(String), this method is asynchronous. This method also allows you to specify the content type of the string being loaded, and so may optionally support other types besides just HTML.
As Hiux suggests in comments:
<base>tag is the trick to load relative resources with