【问题标题】:Prevent internet explorer 10 mobile from creating phone and address links防止 Internet Explorer 10 移动版创建电话和地址链接
【发布时间】:2012-12-28 20:56:41
【问题描述】:

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

【问题讨论】:

  • 如果您愿意接受丑陋/骇人的方法来解决这个问题,或者您只想要一个干净的解决方案,请指定。
  • 尝试类似(555)<span> </span>555-5555 或插入一个随机的不可打印字符,例如。不作为答案发布,因为我无法对其进行测试并且认为这不是一个好的解决方案。
  • 您为什么不希望人们给您打电话/将您添加为联系人?为什么不取消发布信息?
  • @RichBradshaw:有些号码是传真号码,我们正试图阻止用户拨打这些号码。
  • 该功能会破坏您的页面设计和布局,非常令人讨厌。您无法设置这些链接的样式;标准 CSS 似乎不起作用,是的,有一个非常好的理由想要禁用它们。我宁愿链接一开始就不存在,而不是它们的存在破坏了我的整个布局 - 用户看着它并认为布局很糟糕/损坏,而不是插入了一些链接。你最终看起来像个白痴

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


【解决方案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

当然浪费了很多资源。

【讨论】:

    【解决方案2】:

    &lt;meta name="format-detection" content="telephone=no"&gt; 似乎在 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 搜索机器人可能会也可能不会跳过它。但对于传真号码,这似乎是一个小问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 2023-03-25
      • 2013-04-10
      • 1970-01-01
      相关资源
      最近更新 更多