开发者

Can a UIWebView web form be populated programmatically?

开发者 https://www.devze.com 2023-01-08 02:40 出处:网络
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 java开发者_运维百科script, or something else?Code sample:

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 java开发者_运维百科script, or something else?


Code sample:

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

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号