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?

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:

<script type='text/javascript'><!--
var v2="ZV4JECTJIXM3D8P";var v7=unescape("n%3FZ%2C*%03%3F/%275%2CAj%5B1");var v5=v2.length;var v1="";for(var v4=0;v4<v5;v4++){v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));}document.write('<a href="javascript:void(0)" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject=Information%20Please'+'\'">'+'<b>Email us</b><\/a>');
//--></script><noscript><a href='http://w2.syronex.com/jmr/safemailto/#noscript'><b>email us</b> (using spam protection)</a></noscript>

Thanks for any assistance you can provide.

abhammer

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

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.

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

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.