Hide your email from SPAMbots
There are many ways to try to hide emails from spammers. However many of them fail in more advanced spammers systems.For example, many people suggest to use entities to display part or all the email.
I can be sure that this method works in all browsers, but not for advanced spammers. It is quite easy to translate those entities to letters using simple existing functions in almost any computer language.
There are most advanced methods using Javascript, in which the email is broken in parts or even encrypted. However, if they use the "document.write()" function to display the real email (which most of them do), the email will be displayed "automatically" in the source if you save the page as HTML.
Even that is not a common spambot method, it can be done really easy.
Other disadvantage is that it may be quite easy for advanced spammers systems to spot simple (or common) Javascript codes (like splitting the email with "@"), increasing the probability to rank higher as real emails.
Finally, other sites suggests to use CSS to display the email, using the "content" property. This is a good alternative, but it lacks of support at least in IE7.
Best methods (IMHO):
1. Using php: (for personal webpages)
Example Here (Bottom part) Source Code Here
The main advantage is that only humans can read the "hidden" email and additionally your are feeding spammers with lots of fake emails every day.
However it has 2 problems: You need to copy manually the email address if you want to write the author and it takes so much space comparable with a one line email address.
2. Using CSS or HTML + JS: (for any website)
I took the idea from this article and extended it through javascript.
In this method, you write down you email in reverse order and displayed correctly using CSS or HTML.
For CSS use:
unicode-bidi:bidi-override; direction: rtl;
For HTML use the "bdo" tag: <bdo dir="rtl"> ... </bdo>
The main advantage is that if you have javascript enabled, you are one click away of writing an email. The disadvantage is that if you copy and paste the email, will be pasted reversed.
Compatibility:
CSS: If you have IE5 (or older) or (according to some reports) some previous versions of Opera and Safari, you will see the email reversed.
HTML: Only the old version of Safari2 do not support it (according to what I found on Internet).
Example Here
Code:
<html>
<head>
<script type="text/javascript">function hmail(o) window.location="mailto:"+o.text.split("").reverse().join("");</script>
<style type="text/css">a.hmail {unicode-bidi:bidi-override; direction: rtl;}</style>
</head>
<body>
<a href="#Click Here" onclick="hmail(this); return false;" class="hmail">moc.oofaw@oof</a>
</body>
</html>
* Tested without problems in: IE6, Firefox3, Opera9, Chrome3, Safari4 (in higher versions should work too)
Final notes:
If you don't want to reverse your email, you can use a title instead and apply the mail directly in javascript like this:
<a href="javascript:toMyMailPlease()">Contact me</a>
<noscript>Please enable JS to contact me</noscript>
function toMyMailPlease() {
var realmail = .... ; //use any JS ofuscator function here
window.location = "mailto:" + realmail;
return false;
}
This way you are not exposing the email even when the page is saved as HTML, but JS (and a click) will be required.
References:
JS Reverse | CSS Reverse
guest@alepe.com:~/Blog/$ ls
drwxr-xr-x lepe 4.0K 2019-04-30 04:07:16 .
drwxr-xr-x lepe 4.0K 2019-04-30 04:07:28 ..
-rw-r--r-- lepe 2.8KB 2019-04-30 04:07:15 cache_management_in_php.html
-rw-r--r-- lepe 5.3KB 2019-04-30 04:07:15 hide_your_email_from_spambots.html
-rw-r--r-- lepe 3.3KB 2019-04-30 04:07:16 my_linux.html
-rw-r--r-- lepe 8.3KB 2019-04-30 04:07:16 simple_intranet_dns_server_in_linux.html
guest@alepe.com:~/Blog/$ |
---|