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.

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):

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?

Back to top

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.

SpamSpan Code Examples
Paranoia Level HTML Code JavaScript
Enabled Disabled
1
<span class="spamspan">
<span class="u">user</span>
@
<span class="d">example.com</span>
(<span class="t">Spam Hater</span>)
</span>
Spam Hater user@example.com (Spam Hater)
2
<span class="spamspan">
<span class="u">user</span>
<img alt="at" width="10" src="@.png">
<span class="d">example.com</span>
</span>
user @ example.com user @ example.com
3
<span class="spamspan">
<span class="u">user</span>
[at]
<span class="d">example [dot] com</span>
</span>
user [at] example [dot] com user [at] example [dot] com
4
<span class="spamspan">
<span class="u">user</span>
@
<span class="d">example.com</span>
(
<span class="t">Spam Hater</span>,
Subject: <span class="subject">Hi there!</span>,
Body: <span class="body">How's life?</span>
)
</span>
user @ example.com ( Spam Hater, Subject: Hi there!, Body: How's life? ) user @ example.com ( Spam Hater, Subject: Hi there!, Body: How's life? )

Back to top

How do I install SpamSpan?

It's very simple.

  1. Download SpamSpan (spamspan-latest.zip).
  2. Extract spamspan.js
  3. Upload spamspan.js to your server.
  4. 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

  5. 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".

Back to top

SpamSpan HTML Code Generator

  1. 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.
  2. Paranoia level is the securty/obscurity level you want to have. Refer to the code examples section.
  3. 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.
Code Generator
(optional)
(optional)
(optional)

Back to top

Frequently Asked Questions

Is it really free?

Yes! SpamSpan is 100% free for personal and commerical use. I'd appreciate an ego stroker, in a form of a link, even if it's deep down on the "about my dog" page, but it's not necessary.

How is SpamSpan licensed?

This program is distributed under the terms of the GNU General Public Licence version 2. But I am happy to consider licensing under other terms upon request.

I have a question/suggestion/bug report/complaint. How can I reach you?

You should email me at info [at] spamspan [dot] com. Please provide detailed explanation of your problem and examples (if you have any). The more details you provide, the faster you'll get a reply.

Can I use an image instead of anchor text?

Unfortunately this is not supported yet, and I am not sure if I will. This can be achieved with a background image to replacement the text.

Back to top