Need a little help with anti email spam javascript

I want to protect my website against spambots with javascript.

I found this code, I have two questions.

1 - Will this code protect my email adres? 2 - Can someone explain me how to add this line:

<SCRIPT TYPE="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<A href="mailto:' + emailE + '">' + emailE + '</a>')
 //-->
</script> 

This is the line to add:

<span title="Stuur ons een e-mail"

This is what I have, I can't test it at the moment, can you verify it's correct?

<script type="text/javascript">
emailE=('info@' + 'friesecomputerservice.nl')
document.write('<a href="mailto:' + emailE + '">' + '<span title="Stuur ons een e-mail">'+ emailE +'</span>' + '</a>')
 //-->
</script>

Answers


Let's analyse the code together emailE=('info@' + 'friesecomputerservice.nl') a var emailE equals a concatenation of 2 strings which is evaluated to `emailE = 'info@friesecomputerservice.nl'

then second line document.write('<a href="mailto:' + emailE + '">' + '<span title="Stuur ons een e-mail">'+ emailE +'</span>' + '</a>') Writes is the document an HTML line which is <a href="mailto:info@friesecomputerservice.nl"><span title="Stuur ons een e-mail">info@friesecomputerservice.nl</span></a> Which is translated by web-browser into an ordinary link to email

What this script does .. it doesn't write the email in document as it is it makes it bit harder for bots to read the email

although it isn't good enough an ordinary bot can still read your mail clear after HTML markup

I advice you to write your email in a picture, and show it in the page

If you want to create the image dynamically (to encrypt user specific email for example), you can search for a PHP library , that would create the image at the server side


Generally a "decent" bot would be able to analyse the rendered HTML of the page (as in: what you would see on screen), so IMO this wouldn't work - the bot would be able to see the full email address.

I'd go down the route of a contact form with CAPTCHA. I personally don't like an image for the email address, as it (in my experience) annoys end users.


Need Your Help

How to add Bugs to TFS 2012 task board

tfs2012

I'm trying to follow the instructions at http://msdn.microsoft.com/en-us/library/hh739066(v=vs.110).aspx for "Work item types that appear on the task board page". I add &lt;WORKITEMTYPE name="Bug"...

MVC to MVC2 Errors

c# asp.net-mvc asp.net-mvc-2

I've just updated to VS2010 (rc) and subsequently been forced to update my projects and convert to MVC2 (ta microsoft)... which has scuppered the first app its touched.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.