I need to remove hyperlinks from the URL shown in UIWebView, and I reviewed this question: Removing hyperlinks from the URL shown in UIWebView .
I know that I need to use this method:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
But I still have some problems.
Firstly, how can I avoid only certain links (for example: www.google.com).
Next, how do I avoid all the links in my UIWebView?
My code is as follows:
[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 to be guided. Thanks..
The HTML line 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>
source share