记录一下,方便与以后复制粘贴
//主要的协议方法
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
//1.截取到当前地址
NSString *urlStr = request.URL.absoluteString;
//2.做你想做的操作
if ([urlStr containsString:@"http:"] || [urlStr containsString:@"https:"]) {
QYAnotherLinkController *webVc = [QYAnotherLinkController controller];
webVc.urlStr = urlStr;
[self.navigationController pushViewController:webVc animated:YES];
return NO;
}
return YES;
}