4

I've come up with an simple question. I would like to get the DOMDocument of the Android webview.

What I've done to solve this:

  • Google this
  • Reading the docs
  • wrote this question

What I've found is this:

  • Over hundred of people who say you can't access this.
  • While working the webview layout didn't get any children in the debug view of an IDE.

And here more questions of mine:

  • Isn't there any way to get this object?
  • Which object has an reference to this object or owns the DOMDocument?
  • Does the webview just reinterprete the document into a layout or does the webview realy draws the document?

Thanks to everyone who can give a hint or answer these questions.

EDIT: As mentioned I could use a js interface but I do not use this to keep the js environment clean and do not create any variable which could create an issuse with the javascript on webpage.

WebView.evaluateJavascript(
"function(){return "JSON";})();",
new ValueCallback<String>(){ 
    public void onRecieveValue(String p1){
    //TODO : CODE HERE
    }
});
  • Use a JavaScript Interface to return the html source and parse using a parser like jsoup and load the changed document into the WebView or change the document using JavaScript. See: http://stackoverflow.com/questions/4325639/android-calling-javascript-functions-in-webview – Frederic Klein Oct 24 '16 at 12:08
  • Thats what i do at the moment but its just a workaround im using a anonymus function with return value to keep the javascript environment clean ill add that as description – J Mustermann Oct 24 '16 at 12:13

0 Answers0