如何在iPhone Mail应用程序中禁用电话号码链接? [英] How do you disable phone number linking in iPhone Mail app?

查看:120
本文介绍了如何在iPhone Mail应用程序中禁用电话号码链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司正在发送数字电子邮件收据,遇到iPhone Mail正在检测数字数据并将其自动链接为电话号码的问题。我已经看到应该在iPhone上的Mobil Safari中解决问题的元标记,但是这个伎俩似乎不适用于Mail。



有谁知道去做这个?



谢谢!

$ b(为了防止邮件检测到它),因为它被动态填充$ b

解决方案

我有完全相同的问题 - 电子邮件收据中的UPC将自动检测为电话号码,使电子邮件看起来不错,所有的链接。我发现了一个对我有用的窍门:我写了一个函数,它将每3个字符获取字符串数据并嵌入零宽度非连接字符(& zwnj; )我随机选了3个,你可能会做更少的插入,但仍然中断,但我没有测试)。我的c#函数看起来像:

 私有字符串iPhoneDisruptAutoLinks(string val)
{
StringBuilder newVal = new的StringBuilder();
int count = 0;
foreach(val.ToCharArray()中的char c)
{
count ++;
if(count == 3)
{
count = 0;
newVal.AppendFormat(& zwnj; {0},c);
}
else
{
newVal.Append(c);
}
}

return newVal.ToString();
}

所以1234567890的UPC将呈现为:

  123& zwnj; 456& zwnj; 789& zwnj; 0 

我在iPhone 4 / 4S上的测试非常棒。我没有测试iPhone 3或iPad。



此方法也似乎会中断iPhone 4 / 4S地址检测(这对我们来说是另一个烦恼)。



希望这有帮助。


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!

解决方案

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.

这篇关于如何在iPhone Mail应用程序中禁用电话号码链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆