![]() |
|
#1
|
||||
|
||||
How to hide e-mail address from SPAM Bots [Javascript Tutorial]Title says it all. I will demonstrate one of the better methods used to hide your e-mail address from the nasty eyes of SPAM Bots.
Our method of choice will be javascript! Create a new file and name it gen_email.js. Modify the file to fit the needs of your domain name. Here is a sample script: HTML Code:
Save the file. Insert the code to include the file in your page. Someplace between the <head> and </head> tags you will need to place the following code: HTML Code:
Of course, use the right folder for the script, I set mine up in a folder named scripts, this is where I include all of the scripts that I use. Now that we have the basic script used to hide the e-mail address, next we will need to 'call' the function somewhere inside the page in order to display the e-mail address. To do this, you will need to open the page that you want the e-mail address displayed on. Goto the line you want the e-mail address displayed, and put this code on the line: HTML Code:
This simple code will display the e-mail address: something@yourdomain.com. Of course, you will want to replace something with the beginning part of the e-mail address. If you wanted to use support@yourdomain.com, you would then have something like this: HTML Code:
Please post any problems or questions you have below. Enjoy! __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
|
#2
|
||||
|
||||
|
Good one... recently I have been coming to grips with JavaScript and it is my plan to have a collection of JS functions like these all stored in one global JS page. Another one you can work on is (if you find the time of course), one that manages external links easily - you know, the ones you don't want the Search Engine bots to follow
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
||||
|
||||
|
Quote:
Explain some more about what you want. Maybe make a post about it in detail? How many more scirps until you will give us our very own javascript forum!?!?!? Another thing, how come the tags do not work? I tried the same with but apparently those are not in here yet too.. Curious __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
|
#4
|
||||
|
||||
|
The [JS] bbcode tags are not done ...yet, in the meantime you can use [code], or [html ] bbcodes if you prefer.
The function I am looking for is probably something like this: HTML Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
|
There is a small error in your Javascript...
Quote:
"<\/a>" -OR- '</a>' |
|
#6
|
|||
|
|||
|
Hi Bobby,
Thanks for the tip! Do you, by any chance, know how spam bots work? Couldn't they read the post-JavaScript text and collect that? Or do they simply scan through the HTML? Conker __________________
You're not supposed to be looking at this. |
|
#7
|
||||
|
||||
|
Do I know 100% for sure? No. My most logical guess would be that they read through the html file. They specifically search for the character @ or the ASCII for that character. Then they take the first part that is before the @ as the name, and the part after the @ as the domain.tld.
I am pretty sure that the bots do not search in javascript code if you include it outside of the source. Maybe there are some that do, but most wouldn't. But, we also take the precausion that they do, so we never display the e-mail address as one (soemthing@something.com). It is broken up, and then displayed on the page normally. __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
|
#8
|
||||
|
||||
|
I've written a code scrambler in JS and C. Check them out under utilities at http://wildeware.com. The JS can be used directly from the site, and 2 other versions (GUI and console mode) can be downloaded.
If you try them, let me know what you think. |
|
#9
|
|||
|
|||
|
I was about to say something really stupid, but then I realised.. if you code the function in php you still have the same doubt as to whether the spambot can read the code or not, right? I suppose it depends how the spambot works..
|
|
#10
|
||||
|
||||
|
Quote:
By taking Bobby's code and converting it to PHP or even ASP, and putting that function in a separate file, you've accomplished the same end -- the email is split over your entire website. A further encoding possibility is to make the '@' a value expression. The value for @ is hex 40. Make ATval = 20 and when you need the AtSign, add ATval to itself and convert to character. That way the bot has no @ nor hex 40 to find. This is probably overkill, but I doubt any bot would ever find the email address. |
Recent GIDBlog
Review: Gel laptop cooling pad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The