Version 2
After 2 years I have yet to receive a single spam on any email address protected by ELinks. New... An ELinks Installer is now available to verify and simplify conversion. ELinks Installer
ELinks is Free, use it to protect your email addresses.
If you are a new domain name owner start taking measures now to prevent/reduce spam.
Don't even consider a "Temporary Under Construction" web page that contains a "maito:" link that
doesn't implement some form of hiding your email address from Spambots.
The HTML "mailto:" link has become the most abused HTML tag ever used.
It is one of the main sources of data collection used by spammers in creating databases of email addresses to send spam.
Statistics suggest that close to 90% of all email sent over the internet is spam.
Bad HTML: <a href='mailto:info@example.com'>info@example.com</a> becomes <span class="elink" title="info"></span> which is seen as
Version 2 Last updated: June 21, 2010
Click on the button to view the original version 1 documentation. New users should ignor the changes to version 1.
Spambots are used to collect e-mail addresses on the Internet to build mailing lists for sending unsolicited e-mail (aka: spam).
Spambots are web crawlers that can gather e-mail addresses from Web sites, newsgroups, special-interest
group (SIG) postings, and chat-room conversations. Since an e-mail address have a distinctive format, spambots are easy to write and implement.
While some will say that the the only way to prevent spam is to not give your email address to any one. Unfortunately this is not entirely true.
Once a spammer (aka: low life) becomes aware of your domain name they may start sending spam to commonly used user-names such as John@, Jane@ ..etc.
However, most spammers (aka: a low life lower than a snakes belly) use Spambots to build a database of legitimate email addresses.
The spambots collect email addresses by visiting websites and searching the text in your documents. If a website contains any
html <a> anchor tags that contain the "mailto:" link the spambot will extract (harvest) the address and add it to their database of
legitimate email addresses and start sending them spam.
The purpose behind this script first and for most is to prevent spambots from acquiring email addresses contained in a webpage.
The second objective was to ensure that the script was simple and easy to impliment without having to understand HTML code.
This also created an opprotunity to contribute to the well being of the internet community by helping to reduce internet traffic (bandwidth)
and of course the reduction of spam.
You can contribute to the well being of the internet by taking steps to prevent spammers from
acquiring any email addresses in your web documents.
If you search the internet looking for ways to obscure your email address you will get hundreds of links. Most of them use JavaScript in some
form or another to obscure an email address. All modern day browsers recognize and execute JavaScript code (unless the user
has it disabled, which I'll discuss next). JavaScript was designed for client side execution and is safe on legitimate websites.
ITI's ELinks script also uses JavaScript to display an email address to the visitor. Here are a few of the differences compared to other techniques.
You don't have to edit both the html and the script to add an email link.
Just add links to the HTML. Most editors allow you to add tags and their attributes without the need to manually edit the HTML code.
You can add an email link just as easily as you would have added a mailto: link
Has all the same features available in a "mailto:" link.
Does not contain any references to a "mailto:" link.
Automatically takes into account users with JavaScript disabled. The <noscript> tag is not required.
Uses the DOM (Document Object Model) to generate the visible email address after the page has been loaded.
There is no direct call to the JavaScript function that would suggest the html code is being modified to display an email link.
Even if a spambot scans the JavaScript file there are no references to email.
<a href="mailto:info@example.com" class="mystyle">Email me</a> <openingTag attributes>innerHTML</closingTag>
The "a" which is an abbreviation for "anchor" is the element.
An element when enclosed with < and > becomes an element tag, in this case an anchor tag.
"href" and "class" are attributes of the element. The value of the attribute is the part after the "=" sign between the quotes.
The attribute value/pairs are assigned to the element inside the elements opening tag.
The text (or mark-up) between the opening and closing tags is the elements innerHTML, in the above example, the words "Email me".
All the parameters used to create a link are assigned to the "title" attribute of the element. Almost all HTML element defaults include the "title" attribute.
The "title" attribute is normally used to display a "tool tip" and ELinks uses this "free form text field" to pass the link values to the script. To a spambot it appears as "tool tip" text.
eg. Place your mouse over this > word, which was created like this: <strong title="This is a tool tip">word</strong>.
The ELinks parameters are in the same format as the HTML element attributes: variable=value pairs (AKA value/pairs):
Variable = Value to = the recipient's email address cc = a cc recipient's email address bcc = a blind copy recipient's email address text = the visible/clickable text (the innerHTML) linktext = same as text. subject = The text you want automatically placed into the subject line of the visitors email client. body = The text you want automatically placed into the body of the visitors email client. class = The ccs style sheet class name to apply to the link when its converted to an email link. css = same as class. (new version 2) tt = tool tip value. (new version 2)
ELinks value/pairs variables are not case sensitive. 'teXT' is the same as 'text'.
ELinks value/pairs actually become the value of the title attribute of the element.
ELinks value/pairs must be separated by commas and enclosed within a single set of quotes assigned to the title attribute. ELinks value/pairs must be separated by semi-colons and contained within a set of quotes assigned to the title attribute. title="variable=value ; variable=value"
(a comma instead of a semi-colon was introduced in version 2 as the preferred seperator)
new In version 2 the equal sign (=) is optional and should now only be used to remove ambiguity. <tag title="variable value, variable value">innerHTML</tag> <tag title="variable=value; variable=value">innerHTML</tag>
Do not use any quotes around the ELinks value/pairs.
If you require quotes around text for example in the subject line, body text or the innerHTML, use " <span class="elink" title="to John.Doe, text Contact "John""></span> and when converted appears as
The values for "to" and "cc" (ie recipient email addresses) can be used with out the variable names. ("bcc" is required to add a bcc recipient) The values for "to", "cc" and "bcc" (ie recipient email addresses) can be used with out the variable names. <span class="elink" title=" linkText Email Me, recipientA, recipientB, subject Text, bcc recipientC, recipientD " > [no script] </span> <span class="elink" title=" linkText=Email Me ; recipientA ; recipientB ; subject=Text ; recipientC " > [no script] </span>
Elinks considers a value without a variable assignment to be email recipient.
In this case the first value found without a variable name (recipientA) is assigned to the 'to' variable,
the second (recipientB) assigned to the 'cc' variable.
The third (recipientC) has been explicitly assigned to the 'bcc' variable.
Any additional recipients found without a variable assignment are considered to be 'cc' recipients.
In the above example recipientD is also a 'cc' recipient.
In this case the first value found without a variable name (recipientA) gets assigned to the 'to' variable,
the second (recipientB) assigned to the 'cc' variable and the third (recipientC) to the 'bcc' variable.
Elinks considers a value without a variable assignment to be email recipient.
Other than the unassigned recipients order, the order of the value/pair does not matter.
"cc" and "bcc" recipients are optional and seldom ever used but follow the previous rule.
All value/pairs or parameter values are optional. <span class="elink" title=" " ></span> displays absolutely nothing.
In Summary we now have: <span class="elink" title="toname, text Email Me, ccname, bcc bccname, subject Subject Text, body Body Text, css classname" >[no script] </span> <span class="elink" title=" to=toname ; text=Email Me ; cc=ccname ; bcc=bccname ; subject=Text ; body=Text ; class=classname " >[no script] </span>
Note: An elink without a recipient simply creates a clickable link.
<span class="elink" title=" text=Click Me; "></span>
However: <span class="elink" title=" text=Click Me; "></span> displays nothing but generates
an error because variables have been assigned without recipients.
Rename 'href=' to 'title=' and remove 'mailto:' (the word and the colon): <a title="info@example.com?cc=JoeBlow@example.com&subject=Service Enquiry">Email me</a> <a title="info@example.com?cc=JoeBlow@example.com&subject=Service Enquiry">Email me</a> Replace the '@', 'dots' and '=' characters in the href value with spaces: Replace the '@' and 'dots' in the email addresses with spaces: <a title="info example com?cc JoeBlow example com&subject Service Enquiry">Email me</a> <a title="info example com?cc=JoeBlow example com&subject=Service Enquiry">Email me</a> Replace the '?' and '&' characters with commas: Replace the '?' and '&' characters with semi-colons: <a title="info example com, cc JoeBlow example com, subject Service Enquiry">Email me</a> <a title="info example com ; cc=JoeBlow example com ; subject=Service Enquiry">Email me</a>
Remove the innerHTML from between the anchors opening and closing tags and add it as a parameter instead: <a title="info example com, cc JoeBlow example com, subject Service Enquiry, text Email me"></a> <a title="info example com ; cc=JoeBlow example com ; subject=Service Enquiry ;linkText=Email me"></a>
Change the <a> tag to a <span> tag (change 'a' to 'span' in both the opening and closing tags): <span title="info example com, cc JoeBlow example com, subject Service Enquiry, text Email me"></span> <span title="info example com ; cc=JoeBlow example com ; subject=Service Enquiry ; linkText=Email me"></span>
Add the class attribute and assign it a value known to the script so that it can be identified as an elink. <span class="elink" title="info example com, cc JoeBlow example com, subject Service Enquiry, text Email me"></span> <span class="elink" title="info example com ; cc=JoeBlow example com ; subject=Service Enquiry ; linkText=Email me"></span>
Through out the examples the bad HTML links are shown in red and the ELinks links in green followed by what is seen by the visitor and a brief explanation.
Mouse over the link and you should see the converted code in the status bar at the bottom of your browser.
The examples use users in the "example.com" domain (eg info@example.com).
It is important to understand that the examples are written as if the web page is being accessed with "http://www.example.com" in the address bar.
Do not refer to the Source Code for "how to" information as it will lead to confusion. In many/most cases the code has been altered to display correctly on this page.
The <noscript> tag is used to output information when JavaScript has been disabled. If you choose, you can provide a link to
another webpage specifically designed to display content in a non-JavaScript enabled browser or just display an "Informative Message".
With ELinks adding a message is accomplished by simply
adding the <noscript> content (not the tags, just the content) between the <span> tags used to create the email link. Since ELinks
replaces the content between the <span> with the visible email link the noscript content is only visible if the visitor has JavaScript disabled.
To accommodate users without JavaScript you could use a "Contact Us" form.
Although not neccessary, you could add the <noscript> message in the
previous example to advise them of non-functionality (like menus).
In your ELinks innerHTML, add links to a "Contact Us" form. The innerHTML is the data between the <span> innerHTML </span> tags in this case.
In this case there is no need to tell them the email links are disabled because a link to a "Contact Us" form will be visible instead.
Remember if JavaScript is enabled neither the noscript message or the links to the "Contact Us" form will appear.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Your Page Title</title>
<link rel="StyleSheet" href="filenotes.css" type="text/css">
<script language="JavaScript" type="text/JavaScript" src="filenotes.js"></script> <script type="text/JavaScript" src="ELinks.js"></script>
<style type="text/css">.elink{}</style>
</head>
<body onload="ELinks();"> <noscript>
<div style="border:1px solid Red;padding:25px;text-align: center"><em style="color:red">We have detected that you have JavaScript disabled.<br />
To gain the full benefit of our wesite you must Enable JavaScript.</em></div><br />
</noscript>
Hello World
<div align="center">
<span class="elink" title="Info, text Contact Us"> <a target="_blank" href='http://www.CanadianDomainRegistry.ca/contrib/ContactForm/index.php'>Contact Us</a> </span>
</div>
</body>
</html>
We have detected that you have JavaScript disabled.
To gain the full benefit of our wesite you must Enable JavaScript.
About the Contact Form:
Your welcome to use the contact form on your site. Click the "Contact Us" link above to see the form details and download it.
The Contact Form validation is done on both the client side and server side so it will function correctly whether or not javascript is enabled.
You could use the ContactForm in leau of ELinks if you preferred to only allow your visitors to contact you via a form.
The Contact Form scripts are is written in "PHP" and your hosting server must have "PHP" installed (most do).
If you really think it's necessary to show an email address to the visitor with disables JavaScript you could use some text along with a couple of images to display the address.
This technique uses ccs to insert an @ image before the subdomain and a dot image after the subdomain.
Of course the the links aren't clickable and of course it won't display correctly in anything less than IE version 8.
To use CSS, in the HEAD section add the new class styles that contain a reference to the images.
The alternative is to use the <img> tag to display the @ and dots as shown in the body of the example.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Your Page Title</title>
<link rel="StyleSheet" href="filenotes.css" type="text/css">
<script language="JavaScript" type="text/JavaScript" src="filenotes.js"></script> <script type="text/JavaScript" src="ELinks.js"></script>
<style type="text/css">
.elink{}
.elinkImage:before{content:url(elinkBefore.jpg);padding:1px;}
.elinkImage:after{content:url(elinkAfter.jpg);padding:1px;}
</style>
</head>
<body onload="ELinks();"> <noscript>
<div style="border:1px solid Red;padding:25px;text-align: center"><em style="color:red">Our Email addresses are protected by JavaScript to prevent spam.<br />
Enable JavaScript to use the email links on our site.
The email links are shown without the @ and dots.</em></div><br />
</noscript>
Hello World <span class="elink" title="Info">Info <span class="elinkImage"> example </span> com</span>
With <img> tags: <span class="elink" title="Info">Info<img src="elinkBefore.jpg">example<img src="elinkAfter.jpg">com</span>
</body>
</html>
Our Email addresses are protected by JavaScript to prevent spam.
Enable JavaScript to use the email links on our site.
In IE versions less than 8, the email addresses are shown without the @ and dots.
Hello World
Info example com << In compliant css browsers
Info example com << Microsoft hasn't been able to find the funds in their Billion dollar annual income to make their browser css compliant until IE version 8.
With <img> tags:
Infoexamplecom << This should work in all browsers. But what if the visitor also has his download images turned off? I guess he'll just have to figure it out.
ELinks.js is the only file required to use ELinks in your webpages.
Create a new file in a "plain text editor" such as Notepad (not MS Word) and name it ELinks.js, then copy&paste in this code.
Click here to retrieve and view the current Elinks.js file on ITI's servers
Installer.js is an optional script used to find email address as well as 'mailto' links and
proposes the ELinks version of the mailto link.
It also checks and validates the ELinks you create to ensure there are no input errors.
The Installer requires a registration key Installer.
Create a new file in a "plain text editor" such as Notepad (not MS Word) and name it Installer.js, then copy&paste in this code.
Click here to retrieve and view the current Installer.js file on ITI's servers
If you are using ELinks or any other ITI free software please consider making a donation. Developing software and utilities involves an
extraordinary amount of time and effort which takes away from the things that create income.
Contributions make development of this type of software possible and can be your way of saying thank you which will encourage me to add more.
Donate Here
Version 2 released July 2010.
Due to the success of Version 1, Version 2 was expanded to include additional functionality.
Version 2 does not contain fixes to version 1 as it did not have any errors.
Changes in Version 2
Code Cleanliness - faster, cleaner and more effienct resulting better performance.
Revised syntax to reflect good coding practices
Changed/simplified input method to make the ELink title value appear more like sentence.
Changed the configuration paramater names to be easier to understand their purpose
Compressed code for faster transmision/loading
Changed some default behavior to better reflect how a link should appear and behave (eg. bcc recipients must now be specifically assigned)
All attributes found in the ELink tag are removed and reassigned to the converted Elink anchor tag, including event handlers. eg. mouse events
Tool tip text can be added as a paramater to create a new title attribute in the converted link
A seperate installer was created and is available to take the guess work out of creating ELinks ELinks Installer
This may occur if the email link is on a line by itself and/or not inside a set of tags that allocates the space/line while the page is rendering.
To prevent this create a place holder for the email link with a non-breaking space " " or some other text such as "enable javascript to see email address".
The " " (or text) will get replaced with the link after the page has finished loading.
You could also use multiple non-breaking spaces (equal to the length of the email address) if the link is appearing in a paragraph of text.
This may only be an issue if the link appears at or near the top of the page. When a visitor has to scroll down to see the email
address the link will have already been replaced and the content will be where it is supposed to be.