出于安全考虑,我过去常常在手机游戏中使用匿名者。然而这有点烦人。如果我搜索了某些内容并点击了链接,那么google会返回错误消息。您可以尝试.. http://proxy2974.my-addr.org/myaddrproxy.php/http/www.google.com.au/(搜索某些内容并点击链接 - 如果您在桌面浏览器上进行测试,它会正常运行..但如果您在iPhone或iPhone上试用它,它会返回http://proxy2974.my-addr.org/myaddrproxy.php/http/url模拟器)
所以我决定自己做。我正在做的是从文本字段中获取URL并将其传递给匿名者的链接,如urlString = [NSString stringWithFormat:@"http://proxy2974.my-addr.org/myaddrproxy.php/http/%@", urlString];
然而,我仍然面临同样的问题..当我点击谷歌上的链接时,它会返回一个错误..所以我想要做的是获取点击的链接,停止加载页面(在它返回之前)错误),然后通过匿名者传递它..我怎么能这样做?感谢..
- (BOOL)webView:(UIWebView *) sender shouldStartLoadWithRequest:(NSURLRequest *) request navigationType:(UIWebViewNavigationType) navigationType {
NSLog(@"req: %@",request.URL.absoluteString);
return YES;
}
req: http://proxy2974.my-addr.org/url?sa=t&source=web&cd=1&ved=0CFMQFjAA&url=%2Fmyaddrproxy.php%2Fhttp%2Fwww.perthnow.com.au%2Ffun-games%2Fleft-brain-vs-right-brain%2Fstory-e6frg46u-1111114517613&ei=GXAsUMaUA7H44QTys4HYDA&usg=AFQjCNGB_zOrrEZC0SKx813XGHB1xi_AlA
req: http://proxy2974.my-addr.org/myaddrproxy.php?proxy_url_sjla67z78f8viz4=url&sa=t&source=web&cd=1&ved=0CFMQFjAA&url=%2Fmyaddrproxy.php%2Fhttp%2Fwww.perthnow.com.au%2Ffun-games%2Fleft-brain-vs-right-brain%2Fstory-e6frg46u-1111114517613&ei=GXAsUMaUA7H44QTys4HYDA&usg=AFQjCNGB_zOrrEZC0SKx813XGHB1xi_AlA
req: http://proxy2974.my-addr.org/myaddrproxy.php/http/url
答案 0 :(得分:0)
实施
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType;
在你的uiwebview代表中
答案 1 :(得分:0)
实现此委托方法以检索UIWebView中的单击链接:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
if(navigationType == UIWebViewNavigationTypeLinkClicked)
{
NSLog(@"req: %@",request.URL.absoluteString);
}
}