User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,767 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,172 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1350 | Replies: 6
Reply
Join Date: Aug 2007
Posts: 2
Reputation: abhammer is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
abhammer abhammer is offline Offline
Newbie Poster

Question Javascript to protect email

  #1  
Aug 20th, 2007
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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Posts: 2
Reputation: abhammer is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
abhammer abhammer is offline Offline
Newbie Poster

Question Re: Javascript to protect email- added comment

  #2  
Aug 20th, 2007
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
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,774
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 330
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: Javascript to protect email

  #3  
Aug 21st, 2007
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...
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Jan 2007
Posts: 2,510
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 103
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: Javascript to protect email

  #4  
Aug 23rd, 2007
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.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,774
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 330
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: Javascript to protect email

  #5  
Aug 24th, 2007
Its not just about IE, Opera also works fine with the given snippet, thats almost 75% of the browser market.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Jan 2007
Posts: 2,510
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 103
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: Javascript to protect email

  #6  
Aug 25th, 2007
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.
Last edited by MidiMagic : Aug 25th, 2007 at 7:31 pm.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,774
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 330
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: Javascript to protect email

  #7  
Aug 26th, 2007
I thoroughly realize that, my previous post was just an observation...
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:28 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC