Why did the link in UIWebView leave a gray box?

I have a UIWebview that I am loading custom HTML using loadHtmlString. My HTML has a link that I intercept on click so that I can take control and reload the UIWebview with a different line of HTML. The code works, but the area where the link text was placed is replaced with a gray rectangle that appears when a new line is loaded.

What could be here? How can I get rid of this behavior?

// Scott

+2


source to share


2 answers


Here you need to ... add this style statement to the link:

<a href=http://yourlink.com/ style = "-webkit-tap-highlight-color:rgba(0,0,0,0);">

      

Setting the alpha value (the last parameter for rgba) to 0 disables the highlight color.



While this works, it looks like a hack. I really think the red highlight should be cleared when my second loadHtmlString reloads new HTML.

// Scott

+5


source


You can add onclick="this.blur(); location.href=this.href;"

to a link to remove focus from the link.



I'm sure there will be a better less hacky way, but this should work

0


source







All Articles