search for text which you can to test against
- (BOOL)webView:(UIWebView *)localwebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
NSString *path = [[request URL] path];
NSString *pathTrimmed = [path lastPathComponent];
NSLog(@"sfdf %@",url);
NSLog(@"path f %@",pathTrimmed);
if ([pathTrimmed isEqualToString:@"Reset"]) {
// Display alert
UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"You want to Reset Data??" message:@"" delegate:self cancelButtonTitle:@"No" otherButtonTitles: @"YES",nil];
alertb.tag=3;
[alertb show];
[alertb release];
return NO;
}
return YES;
}
and then based on alert call JS Function defined in html page
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex == 1) {
//NSLog(@" its done now uplaod data");
[localwebView stringByEvaluatingJavaScriptFromString:@"confirmation()"];
}
}
No comments:
Post a Comment