1

I need to disable phone number recognition in iPhone's Mail (or other application).

I tried without success the

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

this only works in Safari.

Szekelygobe
  • 2,309
  • 1
  • 19
  • 25
  • Possible duplicate of [How do you disable phone number linking in iPhone Mail app?](https://stackoverflow.com/questions/7478183/how-do-you-disable-phone-number-linking-in-iphone-mail-app) – Marvin Aug 28 '19 at 09:07
  • Yes, probably if I convert that function to php, then it will work. It is a 7 year old answer, so I need to test it. – Szekelygobe Aug 28 '19 at 09:14

2 Answers2

1

As mentiond here:

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

You can add some invisible characters into the string to cheat the recognition.

I wrote a function in php for this inspired by Ookep's answer, tested and it works:

/**
 * Confusing iPhone Mail or other mail client to not recognize numbers/string
 * as phone numbers
 * 
 * @access public
 * @param  $p_text - the sting/number to obfuscate
 * @return the obfuscated string / false
*/
public static function obfuscate_number_recognition(string $p_text): ?string
{
    // if text provided 
    if (strlen($p_text) > 0) {
        // init vars
        $obfuscated_text = '';
        // looping through the string
        for ($i = 0; $i < strlen($p_text); $i++) {
            // building obfuscated text
            // adding invisible space after every 3rd character
            $obfuscated_text = ($i % 3 == 0)
                ? $obfuscated_text.$p_text[$i].'&#8203;'
                : $obfuscated_text.$p_text[$i];
        } // end for
        return $obfuscated_text;
    } // end if valid param
    return false;
} // end func obfuscate text
Szekelygobe
  • 2,309
  • 1
  • 19
  • 25
0

As mentioned on another post, a simple answer is to put a zero-width joiner &zwj; in the middle of the number. It worked for me.

DevOverflow
  • 37
  • 1
  • 11
  • 32