Posts Tagged ‘spam’

Subscribe to spam News

New Legendary Scripts: Kill Spam, Cool Tooltips

Posted at...Posted at April 30th, 2008 by Will in William | Comments1 Comment

Legendary Scripts

Legendary Scripts is a new segment here at AskLG designed to solve some typical web design issues.  Here, I get to play around with Javascript in order to make simple solutions to mundane or difficult tasks.  Today I’m releasing two new scripts.  The first script is a spam hider to help prevent spammers from getting your email address.  The second script focuses on tooltips.  Using CSS and a little Javascript, you too can have tooltips on your website.
(more…)

No Spam Please!

Posted at...Posted at April 7th, 2008 by Will in William | Comments2 Comments

Don’t you really hate it when you put your email address online and bots start to spam it? Me too! Upon launching a new site, I decided to do something about it.

Here is a very simple script that displaces the issue of having mailto: links laying about in your code for spam bots to pick up.

function hide_email()
{
//create regular expression
var regular_expression = new RegExp(”[Mm]ailto”);
//start by checking all links
for(var count=0; count<document.links.length; count++)

{
//is this an email link??
if(regular_expression.test(document.links[count].href))
{
try {
//move email link for safe keeping
document.links[count].name = document.links[count].href;
//replace email link with nonsense
document.links[count].href=”mailto:nospam@nospam.com”;
//keep valid users happy (yay!)
document.links[count].onmouseover = function() { this.href = this.name; };
//keep spammers away (boo bots!)
document.links[count].onmouseout = function() { this.href=”mailto:nospam@nospam.com”; };
}catch (err) {

//oh noes! something bad happened.

}//end catch

}//end if

}//end for loop

}//end hide email

hide_email(); //make function call to execute

Now put this script, right before the </body> (yes ending body tag) tag and it will scour your web page for all mailto: links and save them from bot doom. Of course this isn’t an extremely secure fix, but it’ll do the job against those stupid bots until they get smarter.

Final Note: If you’re using my script for tooltips, then these two aren’t compatible together yet. I think I understand the problem, but it’ll take some testing to verify. Just give me some time and I’ll make a post with new versions.