-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Office 365 and Outlook.com strip <a> tags with empty or invalid href attributes #10
Comments
Thanks! |
This bug gets even weirder when combining styles. It turns out the styles applied to a problematic Huge thanks to @bago at Mosaico for writing about this. Here's an example from their post: <a style="color: red; background-color: yellow;"></a>
<p>A paragraph</p>
<p>Second paragraph with no style</p>
<p style="">Third paragraph with style</p>
<p style="">Fourth paragraph with style</p> On Outlook.com, this becomes: <p>A paragraph</p>
<p>Second paragraph with no style</p>
<p style="color: red; background-color: yellow;">Third paragraph with style</p>
<p style="">Fourth paragraph with style</p> It looks like any style in an invalid <a style="color: cyan; background-color: cyan;">cyan</a>
<a style="color: purple; background-color: purple;">purple</a>
<a style="color: black; background-color: black;">black</a>
<p style="">Empty style 1</p>
<p style="">Empty style 2</p>
<p style="">Empty style 3</p> …becomes: <p style="color: cyan; background-color: cyan; color: purple; background-color: purple; color: black; background-color: black;">Empty style 1</p>
<p style="">Empty style 2</p>
<p style="">Empty style 3</p> |
Thank you @hteumeuleu - it was so hard to find information on this. It was doing this with my http:// href value (localhost) ... 😕 (I assume because https is standard now) |
I'm not seeing the style bug anymore on Outlook.com. I tested the following code:
Outlook is still stripping the tag though. |
Sounds about right! I see the same thing. Thanks for the notification. I'm closing this for now. |
Wait… I closed this bug because the styles sub-bug noted here was fixed. But the main problem listed on the first post is still live and well. So this bug should still be open. |
How to fix this when href is dynamic? the anchor is defined by a handlebar variable |
@lidialodovici do you mean "dev" (pre-production) template builds? If so, if you don't have the means to get templates rendered on ESP-side, there are two options: either render the template locally somehow (I go that approach myself, render Nunjucks templates locally, using mock data files, in Gulp) or find and replace all const regx = /href="{{[^}]+}}/g;
const inp = `{{dont replace me}} <a href="{{foo}}">click</a>`;
console.log(inp.replace(regx, `href="http://test.com`));
// => {{dont replace me}} <a href="http://test.com">click</a> |
When Office 365 and the new Outlook.com encounter an empty
href
, it will remove the<a>
tag but leave its content. For example…… would become :
When you have any content other than a URL inside a
href
, Office 365 and the new Outlook.com will show this content inside the email between brackets. So the following example…… would become :
This bug was discussed on Litmus Forums here.
The text was updated successfully, but these errors were encountered: