UIWebView捕获内部web点击事件

在此有一个webView默认是打开 百度的页面;设置代理,并在代理中处理

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

 1 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
 2 {
 3     //在此捕获当前打开的URL的地址;
 4     NSLog(@"%@",request.URL.absoluteString);
 5     //此内测试在此用webView打开百度页面;点击---新闻---点击新闻分类,当点击新闻为   国际  时,模拟为注册成功,关闭注册页面;就是关闭当前webView页面
 6     //internews
 7     if ([request.URL.absoluteString hasSuffix:@"internews"]) {
 8         NSLog(@"line<%d> %s",__LINE__,__func__);
 9         [self closeView];
10         return NO;
11     }
12     
13     return YES;
14 }
原文地址:https://www.cnblogs.com/cocoajin/p/3480599.html