Forum Moderators: open
The other problem is that it is a fair bit of code for one email address.
Then again, its free and a nice contribution.
Anybody know of any other suggestions? I remember reading of other js solutions through the years.
We have been milling around a very simple solution. Just dont link the email addresses. People who really want to email you can. It really is little to ask serious enquiriers to type your email or copy and paste than just click. That way you may also reduce silly email messages too.
Then also remember that many email scum-companies just get a list or domains and add common prefixes like webmaster, info, sales, etc. and even heard that some just scramble all possible permutations of three letter prefixes meaning if you have a 3 letter or common prefix to the email address, these solutions are still no help!
Interested to hear what others are doing here. A form-mailer is another way I guess.
Then in the page I merely put <script type="text/javascript" src="URLofScript.js"> </script>
I also include a <noscript> link to a text page, which opens in a new window, with contact information. I figure an Email harvesting robot is less likey to spider a .txt page. On the page I include an explanation of why it's being done that way.
--------- addrencode.py ------------------
#!/usr/local/bin/pythonimport sys
import string
def quote(c):
....n = ord(c)
....if 32 < n < 123: return '& #%d;' % n
....return c
def encode():
....m = '& #109;& #97;& #105;& #108;& #116;& #111;& #58;'
....sys.stdout.write('Content-Type: text/html\n\n')
....if len(sys.argv) < 2: return
....parts = string.split(sys.argv[1], ' ')
....e = string.join(map(lambda c:quote(c), parts[0]), '')
....s = string.join(parts[1:] + [string.join(sys.argv[2:], '+')])
....sys.stdout.write('<a href=%s%s>%s</a>' % (m, e, s or e))
encode()
Include this into your HTML per SSI like this:
<!--#include virtual="/cgi-bin/addrencode.py?info@example.com Mail me!"-->
<!--#include virtual="/cgi-bin/addrencode.py?info@example.com"-->
Both forms will encode the info@example.com address with SGML unicode entities, any non-ASCII characters in the address will be passed through unchanged.
The first form will display the link as [u]Mail Me![/u], the second one will display it with the e-mail address as the link text, again properly encoded.
The address may not contain any spaces or "+" signs. I'm not aware of any other limitations.
Feel free to make a mess of it by converting to Perl or PHP... ;)