This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JavaFX and the fly likes how to get the html content in WebView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "how to get the html content in WebView" Watch "how to get the html content in WebView" New topic

how to get the html content in WebView

Bon Gun

Joined: May 30, 2013
Posts: 8
How to get html content in a Web View?
For example,

webview=new WebView();
webengine.loadContent("<b><h1>hello html</h1></b>");

Is there a way to get the html content (<b><h1>hello html</h1></b>) ? How?

Thanks in advance.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 183
You can serialize the DOM which WebView creates (see get the contents from the webview using javafx for details).

Serializing the DOM isn't quite the same as retrieving the html which was originally loaded into the WebView, as the WebView may have fixed quirks in the markup and JavaScript may have dynamically updated the DOM, but it will likely give you a good enough result for what you want.
I agree. Here's the link:
subject: how to get the html content in WebView