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>
Let’s analyse the code together
emailE=('info@' + 'friesecomputerservice.nl')a var
emailEequals a concatenation of 2 stringswhich 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