Anchor links only working in browser but not in in

2020-04-04 03:46发布

I have an HTML email generated from a Windows application. The template used for this is designed in .aspx page. The email has some links at top of the page which should take the user to a detailed description to the end of the same email. This works fine in the browser but doesn't work in Outlook.

<a href="#Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters">Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters</a>

The above anchor tag, when clicked, should go here

<b id="Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters" class="sectionheadline">Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters</b>
<br>
in.reuters.com—March 03, 2014
<br>
<br>
&quot;BOSTON, March 3 (Reuters) - Alsop Louie Partners led a $9 million investment in Wickr, a San Francisco-based startup founded by privacy advocates in 2012 that produces a mobile app for sending self-destructing text, photo and video messages. Gilman...<br><br>.

In View source the id in tag and href in tag match, but in an email when hovered over the link the address has '_' instead of spaces, which is why the links are not working.

标签: html outlook
6条回答
放荡不羁爱自由
2楼-- · 2020-04-04 04:06

So you have coded your anchor tags like such:

<a name="test">Wickr raises $9 mln</a>
<a href="#test>Wickr raises $9 mln</a>

And this is still not working? You should also have a look at campaign monitor for supported browsers. I haven't coded emails in a while, but I remember it was always quite a hassle.

查看更多
3楼-- · 2020-04-04 04:06

While they work in just about every browser, support for anchor links is a mixed bag in email clients. Even though that link says Outlook 2007 (2010 and 2013 are the same) support anchor links, their behavior is unreliable at best.

Simplifying the anchor's <a href=""> increases your coverage. Eg changing something like this:

<a href="#Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters">Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters</a>

to this:

<a href="#first">Wickr raises $9 mln as Alsop Louie, Juniper Networks invest | Reuters</a>

Email clients might trip over spaces and special characters.

查看更多
对你真心纯属浪费
4楼-- · 2020-04-04 04:11

I found that placing the tag

<base href="" />

in the head section worked for me (Outlook 2013) with the standard anchor tag. I found this fix on this page CampaignMonitor

查看更多
太酷不给撩
5楼-- · 2020-04-04 04:11

Sample PDF

'<base href="" />' 

Adding the base tag in header and add the name attribute in anchor work for me

查看更多
在下西门庆
6楼-- · 2020-04-04 04:12

The id/name attribute is like a variable name, for more cross compatible support it really should not have symbols or spaces in the first place.

Think how that would look in the address bar:

  • webpage.html#Wickr%20raises%20%249%20mln%20as%20Alsop%20Louie%2C%20Juniper%20Networks%20invest%20%7C%20Reuters%20

So I guess the silly answer is not to use spaces... That being said, I've noticed both outlook and winword will edit your hyperlink in different ways depending on the prefix "File:" or "http:". Hopefully that helps.

查看更多
Melony?
7楼-- · 2020-04-04 04:16

I tested the following code in Outlook2007 and Outlook2013. It works.

The anchor tag:

<a href="#Test Link">Test Link</a>

And the Target:

<p><a name="Test Link"></a>Test Link</p>
查看更多
登录 后发表回答