|
EMAIL OBFUSCATOR AND ENCODER
Source code:
<script language="JavaScript" type="text/javascript">
// Email obfuscator and encoder - version 1.2
// Example of usage with email address: my-email-address@my-domain-name.com
// Visit http://www.nienteansia.it/altri-files/email_obfuscator_and_encoder/ for more informations and installation instructions
///////////////////////////////////////////////////////////////
// Beginning of email variables - modify to match your email address
var part1=('my-email-address'); // first part of address (before @) - change it to match your address
var part2=('my-domain-name'); // second part of address (after @) - change it to match your address
var part3=('com'); // last part of address without dot (com net org - etc.) -
change it to match your address
// End of email variables
///////////////////////////////////////////////////////////////
// Link text or image - link title - email subject - modify to your liking
var text=('Click here'); // link text - change it to your liking or use an image: <img src="image_path.gif">
var titl=('Send email to:'); // link title - change it to your liking
var subj=('Enter an email subject here'); // email subject - change it to what you prefer or leave it empty
///////////////////////////////////////////////////////////////
// Encoded variables - do not modify
var asciiend=(';'); // ascii code for ; - don't change it
var a1=('ma')+('05'); // ascii code for mai - don't change it
var a2=('lto&#')+('58'); // ascii code for lto: - don't change it
var a4=('&#')+('46'); // ascii code for . (dot) - don't change it
var a5=('&#')+('64'); // ascii code for @ (at) - don't change it
var a6=('?')+('sub'); // ascii code for ?sub - don't change it
var a7=('ject')+('='); // ascii code for ject= - don't change it
///////////////////////////////////////////////////////////////
// encode and put parts of address together
var em=(encodeURIComponent(('<')+('a ')+('hr')+('ef')+('=')+('"'))+(''+ a1 +'')+ (''+ asciiend +''));
var ai=(encodeURIComponent((''+ a2 +'')+(''+ asciiend +'')+(''+ part1 +'')+ (''+ a5 +'')));
var l=(''+ part2 +'');
var ad=(''+ a4 +'');
var dr=(''+ part3 +'');
var es=(encodeURIComponent(''+ a6 +'')+(''+ asciiend +''));
var s=(encodeURIComponent((''+ a7 +'')+(''+ asciiend +'')+(''+ subj +'')+('"')+ (' ')+('ti')+('tle')+('=')+('"')+(''+ titl +'')+(' ')+('' + part1 +'')+ (''+ a5 +'')+(''+ asciiend +'')+(''+ part2 +'')+(''+ a4 +'')+(''+ asciiend +'')+ (''+ part3 + '')+('">')+(''+ text +'')+('</')+('a>')));
var address=(escape((decodeURIComponent(''+ em +''))+(decodeURIComponent (''+ ai +''))+(''+ l +'')+(''+ ad +'')+(''+ dr +'')+(decodeURIComponent (''+ es +''))+(decodeURIComponent(''+ s +'')))); // decode and write address
document.write(unescape(''+ address +''));
</script>
Please don't copy and paste the code above. Follow the instructions below to use the script.
Example 1: Click here (script inserted inside the <body> section of the page)
Example 2: Click here (script loaded from an external .js file - keeps html code cleaner)
Example 3: Click here (using an image instead of a text link)
Installation (script inserted inside the <body> section):
1. Download the script package from the link situated at the bottom of this page.
2. Extract the files on your computer.
3. Open source_code.rtf and modify the following 4 variables to fit your email address and subject of the message: var part1 - var part2 - var part3 - var subj. Example: if the email address you want to protect is address@domain.com, your variables would look like these:
var part1=('address');
var part2=('domain');
var part3=('com');
var subj=('Contact from my site');
4. Modify var text to adjust the link text of your address. Example:
var text=('Click here to contact me');
You can use an image instead of text; just insert the image path as follows:
var text=('<img src="image_path.gif">');
5. You can optionally change the link title that will appear when moving the mouse pointer on the link (var bbb). Default one is:
var titl=('Send email to:');
6. Copy the modified code and paste it into the <body></body> section of the page where you want the email address to appear.
7. That's it. Enjoy!
Installation (script loaded from an external .js file):
<script language="JavaScript" type="text/javascript" src="email_obfuscator.js"></script>
<script>document.write(unescape(''+ address +''));</script>
Download source code and usage examples: click here

|
|
|