No, Marketo tracked links are not “invalid HTML”

Recently got confirmation that a very large German ISP still doesn’t like tracked links in Marketo emails. By “doesn’t like” I mean their webmail totally chokes and displays the (partial) source code:

\

This has been the case for at least a year, probably forever.

Bugs happen, obviously, and bugs get ignored. But I wasn’t amused to hear (via a 3rd party) that the provider won’t fix their bug because they say “Marketo is sending invalid HTML.”

Nope. Not even close.

It’s true that other valid HTML wouldn’t trigger this particular bug, but the bug is entirely on the provider’s side.

(Line) breaking it down

When it rewrites links to bounce off the tracking server, Marketo adds a line break —  a true CRLF, not HTML <br> tag — before the value of the href attribute, after the = sign.

That is, if the original markup in Email Editor looked like this:

<li style="font-family: calibri, tahoma, verdana, sans-serif; font-size: 11pt;">Who’s the <a href="https://www.example.com/goated2022">GOAT</a>

The markup with the tracked link will look like this:

<li style="font-family: calibri, tahoma, verdana, sans-serif; font-size: 11pt;">Who’s the <a href=
"https://click.example.com/NDEwLVhPUi02NzMAAAGE1R-nyfFFL8GAItqktrhaAicK9UZqE
8Puq1dFdcyHeO1h9AXoSuBBVGwOYKaT3-G2zoEoNXc="
>GOAT</a>

Note the line break after <a href= that pushes the URL onto the next line.

The provider claims it’s not valid HTML, and that it’s merely coincidental that no other email client (let alone a web browser viewing a web page) has a problem with it. Those other apps, they say, are being forgiving of bad HTML, and they’re under no obligation to be so forgiving.

But this is easily disproven by looking at the HTML standard.

The standard explicitly allows whitespace (including CRLF) both before and after the equals sign.

Double-quoted attribute value syntax consists of:

The attribute name, followed by zero or more ASCII whitespace, followed by a single U+003D EQUALS SIGN character, followed by zero or more ASCII whitespace, followed by a single U+0022 QUOTATION MARK character ("), followed by the attribute value

ASCII whitespace is defined elsewhere in the spec:

ASCII whitespace is U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.

It’s undeniable that having a line break after the equals sign is valid HTML.

You might still wonder: “HTML emails are more like HTML 4 in terms of which elements and styles are supported, as opposed to full-blown HTML 5. So how about that old standard?”

Well, at least as far back as HTML 3, you could have whitespace on either side of the equals:

An attribute typically consists of an attribute name, an equal sign, and a value (although some attributes may be just a value). White space is allowed around the equal sign.

So it’s a done deal. Marketo’s markup is fine. The provider is a mess!