开发者

How do you disable phone number linking in iPhone Mail app?

My company is sending out digital email receipts and am running into issues where iPhone Mail is detecting numerical data and auto-linking it as a phone number. I've seen the meta tag that should fix the issue in Mobil Safari on the iPhone, but the trick doesn't appear to work for Mail.

Does anyone know how to do this? Manipulating the number itself to insert a hidden ch开发者_JAVA百科aracter won't work (to prevent Mail from detecting it) because its being dynamically populated.

Thanks!


I had the exact same problem - UPCs in emailed receipts would be auto-detected as phone #s and make the emails look bad not to mention confusing with all the links. I discovered a trick that worked for me: I wrote a function that would take string data and embed zero-width non-join character (‌) every 3rd character (I picked 3 randomly, you could probably do fewer inserts and still disrupt but I haven't tested). My c# function looks like:

private string iPhoneDisruptAutoLinks(string val)
{
    StringBuilder newVal = new StringBuilder();
    int count = 0;
    foreach (char c in val.ToCharArray())
    {
        count++;
        if (count == 3)
        {
            count = 0;
            newVal.AppendFormat("‌{0}", c);
        }
        else
        {
            newVal.Append(c);
        }
    }

    return newVal.ToString();
}

So a UPC of 1234567890 would be rendered as:

123‌456‌789‌0

My tests on iPhone 4/4S worked great. I have not tested iPhone 3 or iPads.

This method also appears to disrupt the iPhone 4/4S address detection (which was another annoyance for us).

Hope this helps.


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

Is this what you're looking for?

It's documented in Apple URL Scheme Reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜