Stop iPhone from (Incorrectly) Auto-Linking Phone Numbers

One of the many nice features of iPhone is that Mobile Safari will auto-detect any phone numbers on a web page and turn them into links. Very handy. Much better than remembering the number as you switch from the browser to the phone.

However, this auto-detection is a bit overzealous. In addition to phone numbers, I’ve seen it link date ranges (1978-2008), specific dates (3/9/2009), and—for us baseball stat geeks—offensive rate statistics (.312/.418/.515… and I’ll send a BatchBlue tee shirt to the first person to identify that sweet career line).

Tonight, I was building a page and tested it in iPhone. It incorrectly linked some dates. This was problematic because in that specific section, I had all anchors set to display: block;. So, adding these extra links broke the design.

I could have added some extraneous markup and worked around it, but I was curious if there was a way to turn off this auto-detection. Turns out, there is.

In your <head>, add this line:

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

That will turn off ALL phone number auto-detection on that page. Enjoy!

8 Comments

  1. On March 31st, 2009 at 8:59 pm Craig Jolicoeur said:

    That would, of course, be the one and only Edgar Martinez.

    Nice iPhone tip as well :)

  2. On March 31st, 2009 at 9:07 pm Adam Darowski said:

    Yes sir! You and a Twitter pal got it at about the same time. I’ve DMed you asking for an address. Thanks! :)

  3. On April 1st, 2009 at 2:33 pm Greg said:

    Thanks for the link love. Glad my original post/comment came in handy.
    Follow me @graiz

    - Greg

  4. On November 17th, 2009 at 3:37 pm Tom said:

    Just what I was looking for, thanks!

    It’s interesting that the iPhone Safari is so willing to auto-link common non-phonenumber formats, such as the standard MM/DD/YYYY date.

  5. On November 17th, 2009 at 3:40 pm Tom said:

    Woops, meant M/DD/YYYY.

  6. On March 14th, 2010 at 12:06 pm Sam Marsh said:

    Any ideas on how / whether you can change the way iPhone decorates the telephone link? I don’t seem to be able to overide this by text-decoration: none etc.

  7. On March 14th, 2010 at 4:56 pm Sam Marsh said:

    I’ve come to the conclusion that using &shy; to prevent iPhone reading the digits as a telephone number is the best workaround at present…

  8. On March 15th, 2010 at 9:32 am Adam Darowski said:

    Hey Sam (I fixed your comment… darn code samples!),

    Thanks for the tip. Soft hyphen, eh? Never used it. Interesting.

Got Something to Say?

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>