【问题标题】:Alternative for anchor tag in htmlhtml中锚标记的替代方案
【发布时间】:2016-12-28 15:13:28
【问题描述】:

我目前在 asp.net 中发送邮件。

我已经做到了。

mailMessage.IsBodyHtml = true;

我还想在其中附加一个链接,该链接将作为链接出现在邮件中,并将重定向到移动屏幕。所以一定不是简单的文字。

<a href = \"com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "\" >com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "</a>

但它不会显示为链接,然后我将链接作为。

<a href = \"http://com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "\" >com.myapp://ScreenId=102&Code=" + auser.VarificationCode + "</a>

它显示为链接,但移动开发人员无法处理http://,所以锚标记的任何替代方案?

【问题讨论】:

  • 如您所见,here 锚点的开头不需要http://https://。还有一些相对的锚链接,比如/my/path/ 甚至#mySection。因此,您的 com.myapp:// 也应显示为链接(如您在小提琴中所见)。你用什么邮件软件来显示邮件?
  • 感谢您的及时回复。我试过了,但它只显示“com.myapp://ScreenId=102&Code=[CODE]”.. 它没有显示为链接格式。我没有使用任何仅使用 gmail 的软件。

标签: asp.net html email


【解决方案1】:

Rana,我认为你的做法是正确的。请在下面查看有关这些文章的更多信息。

link from HTML href to native app

Android Custom URL to open App like in iOS

我不知道您的移动应用在哪个平台上运行。下面是一个在 android 上的 Intent 示例。

<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/gizmos" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- Accepts URIs that begin with "example://gizmos” -->
    <data android:scheme="example"
          android:host="gizmos" />

</intent-filter>

以下 XML sn-p 显示了如何在清单中指定意图过滤器以进行深度链接。 URI“example://gizmos”和“http://www.example.com/gizmos”都解析到这个活动。

据我了解,com.myapp... 和http://com.myapp... 都受支持,但这取决于您的配置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-09
    • 1970-01-01
    • 1970-01-01
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多