i have searched the net, but the given solutions doesn’t fit my needs..
So i have a webview, and my webview loads data like this:
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
[_webView loadHTMLString:htmString baseURL:baseURL];
That html string has anchor tags with href e.g – < a href=http://url.com/ … /> and i trigger some events on shouldStartLoadWithRequest.
Now the problem is i don’t know how to remove the grey selection when this attribute is pressed. I saw people are doing this:
<a href=http://yourlink.com/ style = "-webkit-tap-highlight-color:rgba(0,0,0,0);">
and some similar things, but i want to do it other way. By other way i’m talking that i don’t want to change my htmlString, because it may have a lot of them, and injecting style in every seems not the perfect solution..
So i tried doing like this:
[_webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.style.webkitTapHighlightColor = \"rgba(0,0,0,0);\""];
after i load html string, but it doesn’t work.
So anybody has some suggestions, or knows what am i doing wrong?
EDIT:
Or maybe a simple injection of javascrypt for the behavior i want?
Thanks in advance!!!
This code should do the trick: