0

Does anyone know how I would go about autofilling the username and password of a website on the browser in Android given that I have the login URL, the username and the password? Is there a simple way to do this or is somthing more complicated required? Thanks!

timothyjc
  • 2,188
  • 3
  • 29
  • 54

1 Answers1

2

Use JavaScript :

String username = "cristian";
webview.loadUrl("javascript:document.getElementById('username').value = '"+username+"';");

So basically, what you have to do is a big string of JavaScript code that will get those fields and put values on them; also, you can enable/disable the submit button from JavaScript.

Source : Fill fields in webview automatically

Community
  • 1
  • 1
xDragonZ
  • 12,502
  • 6
  • 37
  • 52
  • 2
    That's good to know but I was hoping for a generic solution which can be used for all websites where the ids of the password and username input fields vary. Any ideas? – timothyjc Feb 16 '12 at 01:52