Skip to content Skip to sidebar Skip to footer

Automatic Credentials Input In Uiwebview - Ios

I want to create an iOS app with a feature that - user can store username and password for particular website, and when the go to that website credentials will automatically typed

Solution 1:

Here is some code I used in the past that allowed me to enter user credentials and click a login button. You'll need to change sid, pin, and btnLogin to the appropriate variables on the webpage you're using (you can find them using "View Source" in Chrome, for example):

//Write Javascript code in a string
NSString* javaScriptString = @"document.getElementById('sid').value='%@';"
        "document.getElementById('pin').value='%@';"
        "document.getElementById('btnLogin').click()";

//Insert string values into the Javascript string
javaScriptString = [NSString stringWithFormat:javaScriptString, yourUsername, yourPassword];

//Run Javascript in web view
[webView stringByEvaluatingJavaScriptFromString:javaScriptString];

Post a Comment for "Automatic Credentials Input In Uiwebview - Ios"