需要遵守协议UIWebViewDelegate
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSString *requestString = [[[request URL] absoluteString]stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"requestString : %@",requestString);
NSArray *components = [requestString componentsSeparatedByString:@"|"];
NSLog(@"=components=====%@",components);
NSString *str1 = [components objectAtIndex:0];
NSLog(@"str1:::%@",str1);
NSArray *array2 = [str1 componentsSeparatedByString:@"/"];
NSLog(@"array2:====%@",array2);
NSInteger coun = array2.count;
NSString *method =[NSString stringWithFormat:@"%@/%@",array2[coun-2],array2[coun-1]];
NSLog(@"method:%@",method);
//采购申请提交成功//采购申请删除//采购申请战败
if ([method isEqualToString:@"purchase/applys"])//查看详情,其中红色部分是HTML5跟咱们约定好的,相应H5上的按钮的点击事件后,H5发送超链接,客户端一旦收到这个超链接信号。把其中的点击按钮的约定的信号标示符截取出来跟本地的标示符来进行匹配,如果匹配成功,那么就执行相应的操作,详情见如下所示。
{
NSLog(@"InviteBtn01");
[self dismissPurchaseSelf];
// [webView.superview.window popViewControllerAnimated:YES];
//[self.navigationController popViewControllerAnimated:YES];
return NO;
}
return YES;
}