Skip to content

Instantly share code, notes, and snippets.

@santosh
Created October 7, 2012 08:03
Show Gist options
  • Save santosh/3847486 to your computer and use it in GitHub Desktop.
Save santosh/3847486 to your computer and use it in GitHub Desktop.
JavaScript: Prevent email ID to be harvested by bots
// it will only work until harvester is a crawler
// "human" harvesters can't be prevented from this
//
// write your email address and put some extra weird
// characters in it, e.g. [email protected]
// now replace your weird characters with "nothing".
var link = document.getElementById('email');
link.href = link.href.replace(/NOSPAM/,'');
link.title = link.title.replace(/NOSPAM/,'');
@santosh
Copy link
Author

santosh commented Dec 16, 2016

I never knew after 4 years I will come searching this gist for a client work. Implementing it on ajneffects.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment