Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

at0m87

macrumors newbie
Original poster
Mar 2, 2012
17
0
Hi guys, i have a UIWebView which acts like an internet browser and loads the HTML of the webpages that it is at.

in the webViewController, the method webViewDidFinishLoad, would have loaded the HTML from the webpage when the webpage finish loading on the UIWebView.

From the HTML i would like to sieve out textfields to facilitate the auto population of that textfield with values stored in my database.

Any methods to do that? The method should be able to work on all websites.
 
i could try
Code:
document.getElementsById('id_name').value
but the ID method is not going to work for me as i need a universal method that will identify textfields on any websites(all websites uses different ID names)

In a login page there will be two text fields so i tried using

Code:
document.getElementsByTagName('INPUT')[0].value
document.getElementsByTagName('INPUT')[1].value
to input in the values but no magic.

i have tried other position in the array. the username and password for Facebook is [3] and[4] whereas for amazon it is [11] and [14]. so the position of where the fields are using the above method is kinda random. Any other suggestion that will work for all website?

it seems to me that some of the websites have consistently set this tabindex="1" for username and tabindex="2" for password. for instance in the webpage like Facebook:
Code:
<input type="text" class="inputtext" name="email" id="email" value="" tabindex="1" />
<input type="password" class="inputtext" name="pass" id="pass" tabindex="2" />
amazon:
Code:
<input id="ap_email" name="email" value="" type="email" size="30" maxlength="128" tabindex="1" autocorrect="off" autocapitalize="off" />
<input id="ap_password" name="password" type="password" maxlength="1024" size="20"  tabindex="2" onkeypress="displayCapsWarning(event,'ap_caps_warning', this);" class="password"/>
dbs bank:
Code:
<input type="text" tabindex="1" maxlength="20" size="32" name="UID" id="UID">
<input type="password" onkeyup="keyUp(event)" onkeydown="return onlyNumerics(event)" tabindex="2" maxlength="9" size="32" name="PIN" id="PIN" autocomplete="off">
but i didn't see this tabindex in google:
Code:
<input type="text" spellcheck="false" name="Email" id="Email" value="">
<input type="password" name="Passwd" id="Passwd">
.

any suggestion?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.