问题
I want to store the clicked URL by UIWebViewNavigationTypeLinkClicked. However I just want to store the clicked URL not a series of URLs after clicking in some URLs with ads. Anyway to deal with this?
回答1:
When you clicked inside webview below delegate will called you need to implement below delegate method then on the basis of this you can check that url and store in an array accordingly-
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest
*)request navigationType:
(UIWebViewNavigationType)navigationType
{
//here you can check the condition on the basis
of navigation type
if (navigationType==
UIWebViewNavigationTypeLinkClicked)
{ //Store the link in array below
// initialized you array somewhere first and then
use below
[mutableArray addObject:yourUrl];
}
}
来源:https://stackoverflow.com/questions/19903783/use-uiwebviewnavigationtypelinkclicked-filter