Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting source code of the page with UIWebView

Hey I am making an app with the UIWebView and there are ajax things on the 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.

like image 909
Samuli Lehtonen Avatar asked Nov 13 '10 14:11

Samuli Lehtonen


1 Answers

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"];
like image 81
Evan Mulawski Avatar answered Sep 22 '22 06:09

Evan Mulawski