I have a WebView with a PDF file and a document in it contains hyperlinks that I want to disable. I tried using this approach but it didn't work, the links still open and load the nasty URLS:
- I put
UIWebViewDelegate
in myViewController.h
- I then put this code in my
ViewController.m
:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (webView == myReadingArticlesWebView) {
return NO;
}
else {
return YES;
}
}
Any ideas how to make this simple and easy to work? I admit that I could make some mistakes in the process I described above.
EDIT:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if ([request.URL isFileReferenceURL]) {
return YES;
} else {
return NO;
}
}
The code above does nothing for me as well