How to change phonenumber color in uiwebview in iphone

I parsed the html content to display in webview. There are phone numbers that are detected by web browsing by default, but these links are displayed in blue, I want to change it to white, how is this possible?

If anyone knows, please tell me.

Thanks in advance.

+3
source share
5 answers

According to this question, all you have to do is set CSS properties a(hyperlinks). See David Thomas Response. In particular, he offers this solution only for telephone URLs:

a[href^=tel] { /* css */ }
+2
source

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

elementId html- ( , )

uiwebview ( ) javascript :

 - (void)webViewDidFinishLoad:(UIWebView *)webView
 {
   NSString *javascripString = [NSString stringWithFormat:@"document.getElementById(\"linkId\").style.color=\"white\";", m_studyId];
   [uiwebview stringByEvaluatingJavaScriptFromString:javascripString];
 }
+1

iPhone a:link. , . CSS , iPhone . , , .

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

CSS , , -.

+1

Try the DarkDust solution. On the client side, it will be something like this:

- (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];
}
0
source

Source: https://habr.com/ru/post/1792443/


All Articles