javascript - UIWebView passing username and password into a form -


i have uiwebview set containing universitys intranet page, code pass in username fine (as number)

nsstring *studentnumber = @"639909"; nsstring *javascriptnumber = @"document.getelementbyid('username').value=%@;"; javascriptnumber = [nsstring stringwithformat: javascriptnumber, studentnumber]; [webviewint stringbyevaluatingjavascriptfromstring: javascriptnumber]; 

however when try run same code fill in password field, work numbers, password text when enter text nothing pass password field. if set password numbers seems work. there in code need change allow pass characters passes numbers

thankyou

(this code password)

  nsstring *password = @"password"; nsstring *javascriptpass = @"document.getelementbyid('password').value=%@;"; javascriptpass = [nsstring stringwithformat: javascriptpass, password]; [webviewint stringbyevaluatingjavascriptfromstring:javascriptpass]; 

i think if change this:

nsstring *javascriptpass = @"document.getelementbyid('password').value=%@;"; 

to this:

nsstring *javascriptpass = @"document.getelementbyid('password').value='%@';"; 

it should work. notice added single quotes around %@.

numbers worked because javascript interpreted password entered number; however, when put string in there no quotes, it's tries run password it's part of code instead of string. should add quotes student number field too, since using number string.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -