0
votes

I'm trying to reading part of HTML source code from website that has been encapsulated by javascript;basically i'm trying to read email which appears in webview but not in real source code using NSString method of 'NSString stringWithContentsOfURL:(NSURL *)url'. it looks like code showing up before hitting up the inner java script (which executes and shows the email address to show). are there any way i can get into NSString the contents that I viewed over UIWebview? I tried to use the method 'webView stringByEvaluatingJavaScriptFromString' it worked for only displaying through webview browser didn't return any string value.

Are there anyway I can get the string?

1

1 Answers

2
votes

This should work in the general case:

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

Just make sure the page is loaded before you call it.