How to disable phone number linking in Mobile Safari?

前端 未结 24 1422
面向向阳花
面向向阳花 2020-11-22 16:56

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is tur

相关标签:
24条回答
  • 2020-11-22 17:37

    Another solution would be to use an image of the IP number

    0 讨论(0)
  • 2020-11-22 17:40

    Add this, I think it is what you're looking for:

    <meta name = "format-detection" content = "telephone=no">
    
    0 讨论(0)
  • 2020-11-22 17:40

    I have tested this myself and found that it works although it is certainly not an elegant solution. Inserting an empty span in the phone number will prevent the data detectors from turning it into a link.

    (604) 555<span></span> -4321
    
    0 讨论(0)
  • 2020-11-22 17:41

    I had the same problem, but on an iPad web app.

    Unfortunately, neither...

     <meta name = "format-detection" content = "telephone=no">
    

    nor ...

    &#48; = 0
    &#57; = 9
    

    ... worked.

    But, here's three ugly hacks:

    • replacing the number "0" with the letter "O"
    • replacing the number "1" with the letter "l"
    • insert a meaningless span: e.g., 555.5<span>5</span>5.5555

    Depending on the font you use, the first two are barely noticeable. The latter obviously involves superfluous code, but is invisible to the user.

    Kludgy hacks for sure, and probably not viable if you're generating your code dynamically from data, or if you can't pollute your data this way.

    But, sufficient in a pinch.

    0 讨论(0)
  • 2020-11-22 17:42

    I was having the same problem. I found a property on the UIWebView that allows you to turn off the data detectors.

    self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
    
    0 讨论(0)
  • 2020-11-22 17:42

    You could try encoding them as HTML entities:

    &#48; = 0
    &#57; = 9
    
    0 讨论(0)
提交回复
热议问题