3

I have parsed html content to display in a webview. There are phone numbers which are detected by webview by default, but those links are displayed in blue color, I want to change it to white color, how is it possible?

If anyone know please tell me..

Thanks in advance.

SriPriya
  • 1,240
  • 15
  • 22

4 Answers4

2

According to this question all you need to do is to set the a (hyperlink) CSS properties. See the answer of David Thomas. Specifically, he proposes this solution for just phone URLs:

a[href^=tel] { /* css */ }
Community
  • 1
  • 1
DarkDust
  • 90,870
  • 19
  • 190
  • 224
1

The iPhone uses the current color setting in the a:link property. It uses that value even if the phone number is plain text and not enclosed with the hyperlink tag. If no CSS definition is set, iPhone uses the default. For those who may not know, you can set the values like this.

<head>
    <style>
        a:link {
        color:#FFCC14;
            text-decoration:underline;
        }
    </style>
</head>

If you do not have a CSS style setting for hyperlink then add it or Change the color to the color that works best for your webpage.

laalto
  • 150,114
  • 66
  • 286
  • 303
1

You can change style color of your html content on server side or in client side.

For doing it from client side you must get first the elementId or class of your html content (you can do it from chrome with right mouse click on the link and selecting inspect element)

Then on your uiwebview (once it finished being loaded) you execute javascript for changing element color:

 - (void)webViewDidFinishLoad:(UIWebView *)webView
 {
   NSString *javascripString = [NSString stringWithFormat:@"document.getElementById(\"linkId\").style.color=\"white\";", m_studyId];
   [uiwebview stringByEvaluatingJavaScriptFromString:javascripString];
 }
M Penades
  • 1,572
  • 13
  • 24
  • thank you, but data i am getting doesn't have any link or classes, for ex.., 938.2222.111 it is detected as phone number but how do i change its color? – SriPriya Feb 16 '11 at 12:21
0

Try DarkDust solution. From client side it would be something like that:

- (void)webViewDidFinishLoad:(UIWebView *)webView{
NSString *javascripString = [NSString stringWithFormat:@"document.createElement('meta');meta.name='format-detection';meta.content='telephone=no';document.getElementsByTagName('head')[0].appendChild(meta);"];
[webView stringByEvaluatingJavaScriptFromString:javascripString];
}
M Penades
  • 1,572
  • 13
  • 24