我想知道这是否真的可行,因为我的问题已经没有解决方案了。bit.ly 短链接毁了我的一天,哈哈。下面的代码是我想要实现的,但这不适用于 bit.ly 链接。它总是先检测 bit.ly 链接,然后再检测 google 重定向链接。
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
if ([[inRequest.URL absoluteString] rangeOfString:@"google"].location==NSNotFound){
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
}
return YES;
}