Yes on Android using addJavaScriptInterface () .
class MyInterface { private String someData; public String getData() { return someData; } } webview.addJavaScriptInterface(new MyInterface(), "myInterface");
And in html in your webview.
<script type="text/javascript"> var someData = myInterface.getData(); </script>
By the way, if the webpage you are using does not belong to you (so you cannot change it), you can insert javascript inline. For instance:
webview.loadUrl("javascript:document.getElementById('someTextField').value = myInterface.getData();");
source share