I need to remove the hyperlinks from the URL shown in UIWebView and I have looked at this question: Removing hyper links from a URL shown in UIWebView.
I know I need to use this method:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
But I still seem to have some problems.
Firstly, how do i avoid only certain links (for example: www.google.com).
Next, how do i avoid all links in my UIWebView?
My code looks like this:
[webUI loadHTMLString:[strDescription stringByDecodingHTMLEntities] baseURL:nil];
webUI.dataDetectorTypes = UIDataDetectorTypeNone;
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"finish loading");
[webUI stringByEvaluatingJavaScriptFromString:@"document.styleSheets[0].addRule(\".active\", \"pointer-events: none;\");document.styleSheets[0].addRule(\".active\", \"cursor: default;\")"];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
return YES;
}
Need some guidance. Thanks..
The HTML string looks like this:
> <div style="font-family: Helvetica"><div style="color: #FFFFFF;"><div
> style="font-family: Helvetica;"><p><span style="font-size:
> 24px;"><strong>Optimal Performance Always</strong></span><span
> style="font-size: 18px;"><br /></span></p><p><span style="font-size:
> 18px;">The standard servicing package<a
> href="http://www.google.com">www.google.com</a></div>