SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2007
    Location
    Italy
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What do you think about this email encoder script?

    I found this javascript wich claims to hide an email address from spambots.
    Is it good in your opinion? I'm not a programmer and I'd like to know your opinions.

    Code JavaScript:
    <script language="JavaScript" type="text/javascript">
    // Example of usage with email address: [email]my-email-address@my-domain-name.com[/email]
    ///////////////////////////////////////////////////////////////
    // Encoded variables - do not modify 
    var asciiend=(';'); // ascii code for ; - don't change it
    var a1=('ma&#1')+('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=('?')+('su&#098'); // ascii code for ?sub - don't change it
    var a7=('ject')+('&#61'); // ascii code for ject= - don't 
    change it
    ///////////////////////////////////////////////////////////////
    // 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
    ///////////////////////////////////////////////////////////////
    // 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 (.com .net .org - etc.) - change it 
    to match your address
    // End of email variables
    ///////////////////////////////////////////////////////////////
    // 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>

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't use any JS at all to do something as small as that.
    I'd make an image for the e-mail address to protect it from spam.
    FOR SALE: 1 set of morals, never used, will sell cheap

  3. #3
    SitePoint Member
    Join Date
    Sep 2007
    Location
    Italy
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's perfectly true, but I want something to be clickable. Images are not practical, in my opinion.

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    No, javascript isn't a good technology to use for this. A server side language process to obfuscate the email address is the best thing I know of to hide email addresses. Nothing is fool proof though - just get a good anti-spam filter that will not stop the spammers - but it will stop you from having to look at the email.

    For example my name obfuscated is the following(without the spaces).
    Code:
    & #109;& #097;& #114;& #107;
    Code:
    mark


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •