Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:17:22+00:00 2026-06-09T07:17:22+00:00

i have searched the net, but the given solutions doesn’t fit my needs.. So

  • 0

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!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:17:23+00:00Added an answer on June 9, 2026 at 7:17 am

    This code should do the trick:

    - (void)webViewDidFinishLoad:(UIWebView *)webView
    
        NSString *js = @"var styleNode = document.createElement('style');\n"
                        "styleNode.type = 'text/css';\n"
                        "var styleText = document.createTextNode('a {-webkit-tap-highlight-color:rgba(0,0,0,0)}');\n"
                        "styleNode.appendChild(styleText);\n"
                        "document.getElementsByTagName('head')[0].appendChild(styleNode);\n";
    
        [_webView stringByEvaluatingJavaScriptFromString:js];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched for a general solution to this but only find answers to
I have searched and searched for this but I think my terminology isn't correct
I have searched regarding this content type,Content-Type: application/vnd.google.safebrowsing-update. though some articles are given on
I'm searched and found other questions on this but none have solved my issues.
I have searched on the net, but i couldn't find a clear example to
Ive searched everywhere for this but cant find the answer. I have used the
I have searched this question but didn't get / or understood the answer I
I have searched the net and searched the net only to not quite find
I have searched through the net and still have no clue how to do
I am using c# .net. Thanks in advance for any help. I have searched

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.