user3815142
user3815142

Reputation: 45

how to remove href grey selection and flickering effect from uiwebview while clicking the href link?

I have some html code load in UIWebView, while clicking on the href some grey selection is showing that creates kind of flickering effect. How to remove the effect?

Using the anchor tag (that contains a button and text) only to observe the click event to trigger some functionality. Is that possible to use any other container like to get the click event?

Below is the html code,

NSString *displayHtmlStr = [NSString stringWithFormat:@"< html>< a href='yourTag01' style=text-decoration:none; color:black;> < button style='width:30px;height:30px;border-radius:100px;'>A< /button>The production stages of the silk and the sales values at each stage< /a> < /html>"];
[mywebView loadHTMLString:displayHtmlStr baseURL:nil];

Here is how I am capturing the click event,

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if(navigationType== UIWebViewNavigationTypeLinkClicked && request.URL lastPathComponent] isEqualToString:@"tag0"])
    {        
NSLog(@"clicked A");   
//Some functionality
 }
}

Thanks In Advance

Upvotes: 2

Views: 941

Answers (3)

Wez Sie Tato
Wez Sie Tato

Reputation: 1186

In style add

-webkit-tap-highlight-color: rgba(0,0,0,0);

Upvotes: 1

Francois
Francois

Reputation: 10978

Have you tried removing the outline?

<style>
*:focus  
{  
    outline: none;  
} 
</style>

Which gives:

NSString *displayHtmlStr = [NSString stringWithFormat:@"<html><style>*:focus{outline:none;}</style><a href='yourTag01' style=text-decoration:none; color:black;> <button style='width:30px;height:30px;border-radius:100px;'>A< /button>The production stages of the silk and the sales values at each stage< /a> < /html>"]; 
[mywebView loadHTMLString:displayHtmlStr baseURL:nil];

Upvotes: 0

Sheshnath
Sheshnath

Reputation: 3393

use background property, this may help you.

< a href='yourTag01' style=text-decoration:none; color:black; background-color:white>

Upvotes: 0

Related Questions