阻止Internet Explorer 10移动设备创建电话和地址链接

时间:2013-01-14 20:37:45

标签: html5 internet-explorer windows-phone windows-phone-8 internet-explorer-10

有没有办法阻止IE 10移动设备创建电话和地址链接。类似的东西: <meta name="format-detection" content="telephone=no">

2 个答案:

答案 0 :(得分:4)

<meta name="format-detection" content="telephone=no">似乎在IE11中运行良好。

虽然我在IE10 Metro / Modern WIN8中没有看到任何电话号码自动检测,但我认为它适用于IE10手机(这对手机来说很有意义)。我会接受你的话,因为我无法测试......

也就是说,您可以使用(888) 999-666传真号码专门设置为:

(888) 999<span style="letter-spacing:-1em">-</span>-6666

双短划线可防止格式检测。我在IE11 Metro / Modern WIN8.1

上测试了它

这是一种hackish,但电话号码的视觉风格几乎不受影响,你应该只看到一个短划线。我还尝试在window.load上通过JS删除双破折号,但没有成功,因此破折号必须保留在DOM中。

Google搜索机器人可能会,也可能不会跳过它。但对于传真号码,这似乎是一个小问题。

答案 1 :(得分:1)

肮脏的解决方案:将文本显示为实时渲染图像。类似的东西用于避免电子邮件收集者获取联系信息。

对于php,您可以尝试GD库。

此示例来自PHP.net页面:

<?php
// Set the content-type
header('Content-Type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

这将输出: text as image http://www.php.net/manual/en/images/21009b70229598c6a80eef8b45bf282b-imagettftext.png

当然浪费了很多资源。