Skip to content

Instantly share code, notes, and snippets.

@jnjosh
Created January 12, 2011 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnjosh/776338 to your computer and use it in GitHub Desktop.
Save jnjosh/776338 to your computer and use it in GitHub Desktop.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[webView setDelegate:self];
[webView loadHTMLString:@"<html><body><p id=\"content\">My Name is Josh</p></body></html>" baseURL:nil];
[self.window makeKeyAndVisible];
[self.window addSubview:webView];
return YES;
}
-(void) webViewDidFinishLoad:(UIWebView *)aWebView
{
NSString *someVal = [aWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById('content').innerHTML"];
NSLog(@"someVal = %@", someVal);
NSString *someNumVal = [aWebView stringByEvaluatingJavaScriptFromString:@"2 + 2"];
NSLog(@"someNumVal = %@", someNumVal);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment