954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Javascript to protect email

I am trying to protect email addresses on a web page from spammers. I found a javascript snippet from Syronex Anti Spam Solutions ( http://www.syronex.com/antispam/ ) and it has worked well in the past. Since I have upgraded Firefox to the newest version I cannot access the email from my links. Is there a reason for this or is there another method I could used instead of javascript in firefox?

abhammer
Newbie Poster
2 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

When I place the cursor over the email link on the web page the following message appears in the bottom status bar "javascript:void(0)". Does this message mean that javascript is not working? I have it enabled in firefox.

The code I am using is below:

email us (using spam protection)

Thanks for any assistance you can provide.

abhammer

abhammer
Newbie Poster
2 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

The above code runs fine in IE and Opera, so it has got something to do with Firefox. I guess the only thing you can do is to let those people know of this issue and see what turns up.

Also if you want to protect your email address, you can always keep an image instead of plain text. The users who need to get in touch with you would just mail at that address. Just an option...

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

You have "<" and ">" symbols in your javascript code. You can't have such a script embedded inside html and expect it to work on all browsers.

Use an external script file.

Also, IE is more forgiving if you leave out a semicolon.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

Its not just about IE, Opera also works fine with the given snippet, thats almost 75% of the browser market.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

It doesn't matter what percentage of the market works without semicolons or with embedded < and > symbols. The W3C standard requires the semicolons, and prohibits using the < and > symbols in embedded code.

All of this is listed on the W3C pages, with what to do to avoid the problems. They say to use the semicolons, and to place any code which contains < or > symbols in separate .js files.

When IE and Opera becomes more standards-compliant, the above code will cease to work.

Never rely on browser quirks.

Also realize that any user can turn his JavaScript off. Then the page will behave as though the JavaScript calls are not present.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

I thoroughly realize that, my previous post was just an observation...

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You