Copied to clipboard

Flag this post as spam?

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

  • Josh Olson 79 posts 207 karma points
    Feb 19, 2013 @ 14:05
    Josh Olson

    Using <img> as link anchor breaks path to image

    I have been using this package for a while and I love it, it makes life so much easier.  I recently came across an issue that I am having trouble sorting.  When I use an image (as opposed to text) as the link for my mailto it breaks the path to the image by adding <!--y--> just before the file extension, as such:

    <a href=""><img src="/images/graphics/email.png" alt"Click to email webmaster" width="16px" height="16px" /></a>

    turns into

    <a href="javascript:if(typeof(sendEmail)=='function'){sendEmail('6D61696C746F3A7765626D6173746572407173692E6F7267');}"><img src="/images/graphics/email<!--y-->.png" alt"Click to email webmaster" width="16px" height="16px" /></a>

    Am I missing something simple here or is this an undocumented feature (bug) in the package? Thanks in advance for any help and/or advice!







  • Lee Kelleher 3905 posts 14863 karma points MVP 10x admin c-trib
    Feb 20, 2013 @ 11:25
    Lee Kelleher

    Hi Josh,

    Thanks for raising this.  Yep, sounds like an undocumented feature! :-)  The code takes the text from inside the link and appends any "@" or "." characters with a HTML comment ("<!--x-->" or "<!--y-->") - this was to prevent spambots from crawlling any email addresses.

    I could look at not replacing the "." characters - if that helps? Happy to take advice on this.

    Thanks, Lee.

  • Josh Olson 79 posts 207 karma points
    Feb 20, 2013 @ 11:53
    Josh Olson

    Hi Lee,

    Not replacing the "." character would certainly address this issue, but would that compromise the effectivness of the package preventing the evil spambots from doing their inevitable crawling? I am grasping here, but if there was an escape sequence that would cause the code to ignore a particular period...? Another possibility I suppose would be to parse the string and check for an <img> tag which could then be ignored.

    Maybe someone has a suggestion on something to do in the HTML itself that would get around the issue...

    If you decide to address this issue, please let me know, but regardless, thanks for the great package!


  • Connie DeCinko 931 posts 1159 karma points
    Dec 08, 2015 @ 19:20
    Connie DeCinko

    I too am coming up against this issue and wonder if it has been resolved. Could you not just ignore the source (src) property of any image tags inside the mailto?

  • Lee Kelleher 3905 posts 14863 karma points MVP 10x admin c-trib
    Dec 08, 2015 @ 21:56
    Lee Kelleher

    Hi Connie,

    I haven't touched the code for SafeMailLink in around 3 years. Currently I have no plans to revisit it.

    Although if you have any ideas on how to fix the code to handle the <img> tag, I'd be more motivated to release an update.

    Here's the line of code that replaces the "." character:

    - Lee

Please Sign in or register to post replies

Write your reply to: