使用
WebEngine.loadContent.
webView.getEngine().loadContent("hello, world", "text/html");
Javadoc描述:
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.
正如Hiux在评论中所说:
using a 07001 tag is the trick to load relative resources with loadContent(String) as demonstrated in his related answer to 07002.