需要遵守協議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;
}