Tutorial :Can a UIWebView web form be populated programmatically?



Question:

If you have a UIWebView, and load a web page with a form on it, can you programmatically populate that form? Either with objective-c or javascript, or something else?


Solution:1

Code sample:

[webView stringByEvaluatingJavaScriptFromString:@"document.myForm.myText.value='text from Obj-C';"];  

You can, basically, execute any JavaScript on your web view...


Solution:2

You can execute javascript with the stringByEvaluatingJavaScriptFromString: method on the UIWebView. This will let you use document.getElementById() etc. to locate and manipulate elements on the page.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »