views:

347

answers:

2

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

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

//Scott

A: 

You could add onclick="this.blur(); location.href=this.href;" to the link to remove the focus from the link.

I'm sure there's a better less hackish way, but this should work

rpetrich
mmm...no go...is there perhaps a webkit-touch parameter that addresses this?
skantner
+2  A: 

Here it is...need to add this style statement to the link reference:

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

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

Although this works, it feels like a hack. I really think the tap highlight should clear itself when my second loadHtmlString reloads new HTML code.

//Scott

skantner