开发者

Getting source code of the page with UIWebView

开发者 https://www.devze.com 2023-01-25 10:55 出处:网络
Hey I am making an app with the UIWebView and there are ajax things on th开发者_开发知识库e site. I need to run 1 ajax thing so the source code will change and after it I need to optain the source cod

Hey I am making an app with the UIWebView and there are ajax things on th开发者_开发知识库e site. I need to run 1 ajax thing so the source code will change and after it I need to optain the source code. Anyway I could do this? Sorry if I explained it too complicatedly.


You can evaluate JavaScript within the UIWebView. Make sure to perform this after the page has completely loaded:

NSString *source = [webView stringByEvaluatingJavaScriptFromString:
                    @"document.getElementsByTagName('html')[0].outerHTML"];
0

精彩评论

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