W3C-Compliant Anti-Spam E-mail Links
#1
Scooby Regular
Thread Starter
Join Date: Apr 2001
Location: West Sussex
Posts: 227
Likes: 0
Received 0 Likes
on
0 Posts
W3C-Compliant Anti-Spam E-mail Links
Hi All,
I have created a website for a philanthropic organisation I am a member of (www.brightonpgl.co.uk). I do not want the e-mail addresses to get harvested by spambots, so I use a simple bit of JavaScript to generate the addresses.
Unfortunately, this means the page will not validate with the W3C (see http://validator.w3.org/check?uri=www.brightonpgl.co.uk), giving the error "document type does not allow element 'a' here".
I have tried a number of different solutions (moving the Javascript to a function in the HEAD section, trying different combinations of text and variables, etc), but nothing validates. Any ideas how I get around this, while still preventing the spambots from grabbing the addresses?
Thanks
Daniel
I have created a website for a philanthropic organisation I am a member of (www.brightonpgl.co.uk). I do not want the e-mail addresses to get harvested by spambots, so I use a simple bit of JavaScript to generate the addresses.
Code:
<script language="javascript" type="text/javascript"> var user = "bro.dhobbs"; var domain = "gmail"; var suffix = "com"; var display = "Contact the webmaster"; document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + display + '</a>'); </script>
I have tried a number of different solutions (moving the Javascript to a function in the HEAD section, trying different combinations of text and variables, etc), but nothing validates. Any ideas how I get around this, while still preventing the spambots from grabbing the addresses?
Thanks
Daniel
#2
Scooby Regular
#3
Scooby Regular
Thread Starter
Join Date: Apr 2001
Location: West Sussex
Posts: 227
Likes: 0
Received 0 Likes
on
0 Posts
Steven,
Thanks for that. I have now extracted the JavaScript into a seperate file (something I should have done anyway, but I was being lazy!). Now both XHTML and CSS valid!
Daniel
Thanks for that. I have now extracted the JavaScript into a seperate file (something I should have done anyway, but I was being lazy!). Now both XHTML and CSS valid!
Daniel
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Flat4x4-again
General Technical
2
29 September 2015 06:32 PM