What is SpamSpan?
SpamSpan is a small bit of JavaScript code (2 KB). It allows you to obfuscate an email address to prevent spambots from collecting it. SpamSpan will reveal the email address to real users, even if their browser does not support JavaScript.
Development of SpamSpan is sponsored by Amazon software development.
Browser Compatibility
SpamSpan is fully compatible with all major browsers (99% of the browser market) and degrades gracefully in others. I personally tested SpamSpan with BrowserCam using the following browsers and confirm that it works under (but not limited to):
- AOL (9.0)
- Blazer® (3.0)
- Camino (1.0)
- Flock 0.5.15.0
- Firefox (1.0.7, 1.5.0, 2.0)
- Internet Explorer (5.0, 5.2, 5.5, 6.0, 7.0)
- Konqueror (3.4.0-5)
- Mozilla (1.6, 1.7.12)
- Netscape (6.2, 6.23, 7.2)
- Opera (7.23, 7.5.4u1, 8.5.0)
- Safari (1.2, 2.0)
If you tested SpamSpan under other browsers and can confirm that it works, please, let me know (info [at] spamspan [dot] com). Are there any browsers left untested anyways?
Just show me the code, dammit!
All right. These are the examples of how you might want to use the SpamSpan. Pick a level of paranoia and go from there.
The code in the following examples was broken down into multiple lines for readability. If you want to keep the code broken down into multiple lines, then you will get extra spaces around the @ signs in the sans-JavaScript version (e.g. user @ example.com). Not that it's a problem, but just something to consider.
Paranoia Level | HTML Code | JavaScript | |
---|---|---|---|
Enabled | Disabled | ||
1 |
|
Spam Hater | user@example.com (Spam Hater) |
2 |
|
user example.com | user example.com |
3 |
|
user [at] example [dot] com | user [at] example [dot] com |
4 |
|
user @ example.com ( Spam Hater, Subject: Hi there!, Body: How's life? ) | user @ example.com ( Spam Hater, Subject: Hi there!, Body: How's life? ) |
How do I install SpamSpan?
It's very simple.
- Download SpamSpan (spamspan-latest.zip).
- Extract spamspan.js
- Upload spamspan.js to your server.
-
Place the following line anywhere inside the
<head>
tag:<script type="text/javascript" src="/CHANGE/PATH/TO/spamspan.js"></script>
Note: do not forget to change the /CHANGE/PATH/TO/ to the actual path of the spamspan.js
- Replace all of the openly listed email addresses in your source code to the obfuscated ones. See code examples or use the code generator.
Optional Configuration
If you wish to be fancy and confuse spambots even further, then there are several configuration variables available. Open the spamspan.js file with your favourite text editor and look for the following configuration options at the top of the file.
- spamSpanMainClass
- Class name of the main
<span>
wrapper. Default value is "spamspan". - spamSpanUserClass
- Class name of the user (the part before the @ sign)
<span>
tag. Default value is "u". - spamSpanDomainClass
- Class name of the domain (the part after the @ sign)
<span>
tag. Default value is "d". - spamSpanAnchorTextClass
- Class name of anchor text
<span>
tag. Default value is "t".
SpamSpan HTML Code Generator
- Fill out the email address and anchor text (optional). If you don't provide anchor text, then the email address will be used as anchor text.
- Paranoia level is the securty/obscurity level you want to have. Refer to the code examples section.
- Press «Generate Code» and then copy and paste the code from the textarea into your webpage. Do not forget to add the
<script>
tag as well.