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

瘦欲@ 提交于 2019-12-12 02:09:24

问题


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 character won't work (to prevent Mail from detecting it) because its being dynamically populated.

Thanks!


回答1:


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.




回答2:


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

Is this what you're looking for?

It's documented in Apple URL Scheme Reference.



来源:https://stackoverflow.com/questions/7478183/how-do-you-disable-phone-number-linking-in-iphone-mail-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!