HTML 电子邮件 iOS 格式检测

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28027330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:22:42  来源:igfitidea点击:

HTML Email iOS format-detection

htmlhtml-email

提问by Travis

I just found that there is a meta tag for removing the phone number as a link in HTML on iOS. Does this work with HTML emails?

我刚刚发现有一个元标记用于删除电话号码作为 iOS 上 HTML 中的链接。这适用于 HTML 电子邮件吗?

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

But is there one for address and date as well? I have always been writing hacks to over come this but if it's a meta tag that is great! Does anyone know the syntax for address and date?

但是地址和日期也有吗?我一直在写 hacks 来解决这个问题,但如果它是一个很棒的元标记!有谁知道地址和日期的语法?

回答by Anonymous

Yes, there is. You can use:

就在这里。您可以使用:

Combining them:

组合它们:

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

回答by Jason Axelson

I've had luck with:

我很幸运:

<style>
  a[href^="x-apple-data-detectors:"] {
    color: inherit;
    text-decoration: inherit;
  }
</style>

回答by joby-flick

<html>
<head>
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="date=no">
    <meta name="format-detection" content="address=no">
    <meta name="format-detection" content="email=no">
    <style type="text/css">
        a[x-apple-data-detectors] {
            color: inherit !important;
            text-decoration: none !important;
            font-size: inherit !important;
            font-family: inherit !important;
            font-weight: inherit !important;
            line-height: inherit !important;
        }
    </style>
</head>
<body>
    123 Main Street<br/>
    Columbus, Ohio 43215
</body>
</html>

回答by Clark Baker

I just discovered that format-detection doesn't work for Outlook.com, Office365, etc.

我刚刚发现格式检测不适用于 Outlook.com、Office365 等。

In my case I didn't want the auto styling OR functionality (of clicking to call or map an address) so I injected some hidden HTML to make it not look like an address.

在我的例子中,我不想要自动样式或功能(点击调用或映射地址),所以我注入了一些隐藏的 HTML 使其看起来不像地址。

Original:

原来的:

<td>123 Main Street
<br/>Cambridge, MA 02138</td>

Updated:

更新:

<td>123 Main S<i class="hidden">-</i>treet
<br/>Cambridge, M<i class="hidden">-</i>A 02<i class="hidden">-</i>138</td>

With this added to your stylesheet:

将此添加到您的样式表中:

.hidden { display:none; }

This was tested and works in the 50 or so email client previews offered by Email on Acid.

这在 Email on Acid 提供的 50 个左右的电子邮件客户端预览中进行了测试和工作。

NOTE:you can't inline the display:none because Yahoo Mail doesn't support that and you'll end up with visible dashes in your address. You need to define a class.

注意:你不能内联 display:none 因为雅虎邮件不支持,你最终会在你的地址中看到可见的破折号。您需要定义一个类。

Removing display but keeping the functionality

删除显示但保留功能

If you want to keep the Bing Maps pop up functionality you can customize the display by adding the class "outlookLink" to the element that contains the address. Source: https://litmus.com/community/discussions/4692-outlook-com-adding-links

如果您想保留 Bing 地图弹出功能,您可以通过向包含地址的元素添加类“outlookLink”来自定义显示。资料来源:https: //litmus.com/community/discussions/4692-outlook-com-adding-links

So this:

所以这:

<td>123 Main Street</td>

Becomes this:

变成这样:

<td class="outlookLink">123 Main Street</td>

with the following in your stylesheet:

在您的样式表中包含以下内容:

.outlookLink span {
      color:#ffffff !important;
      border-bottom-width:0 !important;
      border-bottom-style:none !important;
}

Outlook.com wraps what it determines to be addresses or dates (for calendar entries) in a <span> with its own styling (blue link with dashed underline). This modifies the styling of those <span>s.

Outlook.com 将它确定的地址或日期(对于日历条目)包装在 <span> 中,并使用自己的样式(带虚线下划线的蓝色链接)。这会修改那些 <span> 的样式。

回答by Marco

this is not a standard meta tag, it just work for IOS.

这不是标准的元标记,它只适用于 IOS。

See Apple Developer Documentionto find your answer

请参阅Apple 开发者文档以找到答案

回答by Anthony Delgado

untested but should work.

未经测试,但应该工作。

a[href^=date]{ color:#FFFFFF; text-decoration:none;}
a[href^=telephone]{ color:#FFFFFF; text-decoration:none;}
a[href^=address]{ color:#FFFFFF; text-decoration:none;}
a[href^=email]{ color:#FFFFFF; text-decoration:none;}