Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bjørn Fridal 274 posts 784 karma points
    Nov 20, 2011 @ 16:29
    Bjørn Fridal
    0

    Attributes in mailto link

    Great package. I have used the CodeArchitects.SafeMailLink for a while and have noticed that some link attributes doesn't really agree with it. For instance, if you add a title attribute or a class, the link will no longer be encoded.

    A solution might be to rewrite it with the HtmlAgilityPack instead or Regular Expressions, allowing for very flexibel link matches or else you could tell the Umbraco editors, that they should not add titles to the email links.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Nov 21, 2011 @ 10:19
    Lee Kelleher
    0

    Thanks Bjørn,

    I'll take a look into it... I've been using CodeArchitects.SafeMailLink for long time too - haven't really encountered the attribute problem, (guessing my clients don't modify their contact details much - I dunno).

    I quite like the HtmlAgilityPack too ... might be better to rewrite/refactor it using that! :-)

    Cheers, Lee.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Nov 22, 2011 @ 23:47
    Lee Kelleher
    0

    Hi Bjørn, quick follow up on this.

    I've tested a few variations of attributes in the link and it appears to be encoding correctly.

    Example...

    <a title="hello world" accesskey="E" href="mailto:name@domain.com" class="link">Email Me</a>

    ... outputs to ...

    <a title="hello world" accesskey="E" href="javascript:if(typeof(sendEmail)=='function'){sendEmail('6D61696C746F3A6E616D6540646F6D61696E2E636F6D');}" class="link">Email Me</a>

    I'll keep an eye out for anything strange going on.

    Still curious about using HtmlAgilityPack - do you think there'd be any performance issues with using it for this? (e.g. loading/parsing full HTML)

    Cheers, Lee.

  • Bjørn Fridal 274 posts 784 karma points
    Nov 23, 2011 @ 09:19
    Bjørn Fridal
    1

    Hi Lee,

    Ah sorry looks like you are right. The CodeArchitects.SafeMailLink.dll I tested with was the one I normally use and that looks to be outdated.

    In regards to HtmlAgilityPack I don't think that there would be a performance issue, but that is just based on my own experience. I generally just like the way you query with HAP and that it's so easy to read and maintain, compared (imho) to Regular Expressions. On the other hand, the package looks to be working just fine now :)

    Cheers
    Bjørn

Please Sign in or register to post replies

Write your reply to:

Draft