HTML & CSS
I had used the following code which was supposed to help stop e-mail collection & spam.
Then someone said the link was not working with their iPad. So I reverted to plain old @ and .com to get it working.
Is this bad practice?
Why would their iPad not parse the html properly?
Is there another "easy" method to stop spam when a mailto link is necessary?
Appreciate any comments.
If you use @, that should have the same effect as @. As far as I know, it should work on all devices, but I don't have an iAnything so I can't check it...
only in HTML - not in URLs and the mailto: on the front of the address indicates that it is supposed to be a URL rather than HTML.
Anyway with the mailto: there you may as well use @ since the mailto identifies it as an email address regardless of any obfuscation applied.
I don't get any spam using this. Knowbody would.
Thanks Stevie D and felgall for your replies. Thanks Picnic for your link - that's quite a comprehensive list! I like solution 2 and will try that next time I need.
Why your just going to use the masked @? FYI that may trick 1 out of 20 bots.
Presumably the URL is supposed to be in an attribute value, where entities work fine and are perfectly allowed in all versions of HTML.
The %40 should also work in an attribute value that is allowed to contain a URL so that it isn't working is an indication that it is not being used in an HTML attribute.
If you want to encode the HTML characters and still use a mailto link, you will also need to encode the "mailto:" as well. For some reason, you can't mix the two.
$ascii = NULL;
for ($i = 0; $i < strlen($string); $i++)
$email = string_to_html_ascii('email@example.com');
echo '<a href="'.$mailto_ascii.$email.'">email me</a>';
"mailto link" in the subject indicates otherwise.
That %40 isn't working could just be a bug in the browser or the email app or the OS glue.
This topic is now closed. New replies are no longer allowed.