Start a Project

Android Inject JavaScript into WebView

We can manipulate Webview content or get any input value by injecting javascript. We need some knowledge of DOM element and javascript to manipulate Webview content.

In this blog, We will inject javascript function to get the value of the form field and manipulate DOM properties.

1. Enable javascript in Webview

2. Set WebViewClient and override onPageFinished method. We have injected javascript to get DOM element value.

You can manipulate DOM properties as mentioned below.

Hope, you have got the idea to get the value of the form field and manipulate DOM properties.

 

Exit mobile version