android - loading only a specific element properly in webview -


i trying load specific element in webview webpage ('contentbody'). dont know how modify code load only. can block elements in webview using simple javascript.

public void onloadresource(webview view, string url) {         super.onloadresource(view, url);         // removes element id = 'masthead'         view.loadurl("javascript:(function() { "                 + "(elem = document.getelementbyid('smsform')).parentnode.removechild(elem); "                 + "})()");     } 

an option might use jsoup, load html page website, extract desired portion of html, , load webview. small example of how done:

document doc = jsoup.connect("http://example.com/").get(); mywebview.loaddatawithbaseurl("http://example.com/", doc.select(".contentbody").first().outerhtml(), "text/html", "utf-8", null);  

with this, use jsoup extract first item contentbody class html, , directly load webview.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -