Android. Webview. Show part of page using Javascript -


I want to show the section of the page: the web form that will be filled by the user, the reason is that the web form is inside this tag :

Enter image details here

In Java, I Trying to get the form from the name of the class (because the class name is only a tag with the "form"). Then I'm trying to change the content of the "form" content (maybe I'm doing this wrong) then try to show the content (form only) in the webview

  the last WebView webview = ( WebView) view.findViewById (R.id.wvCheckInn). Webview.getSettings () setJavaScriptEnabled (true). Webview.setWebViewClient (New WebViewClient () {@Override Public Zero onPageFinished (WebView to view, string URL) {string javascript = "javascript: on form = document.getElementsByClassName ('form'); body = document on" + " GetElementsByTagName ('body'); "+" body.innerHTML = form.innerHTML; "; view.loadUrl (javascript);}}); Webview.loadUrl ("http://businessinfo.uz/service/inn");   

Result: Webview is showing the whole page, which is not good for me How to show part of the page in web-view using Javascript?

"itemprop =" text ">

In your Javascript, document.getElementsByClassName () and document.getElementsByTagName () DOM elements both return arrays (Before "notice" by K.) it is getElementById (), which gives an element directly, which makes sense since the IDs are unique in a valid HTML document, but not tags and classes

Elements and JavaScript works before each array.

  body [0] .innerHTML = form [0] .innerHTML;    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -