3

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

4

2 回答 2

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 上测试过

这很骇人听闻,但电话号码的视觉风格几乎不受影响,您应该只看到一个破折号。而且我还尝试通过 JS 在 window.load 上删除双破折号,但没有成功,因此破折号必须保留在 DOM 中。

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

于 2014-02-01T08:22:21.113 回答
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);
?>

这将输出:( 来源:php.net文本作为图像

当然,很多资源都被浪费了。

于 2013-04-08T16:47:54.253 回答