Last active
August 29, 2015 14:07
-
-
Save andrewmilson/d496f4b685843c660d2c to your computer and use it in GitHub Desktop.
Protects mailto email links from spam bots - http://andrewmilson.com/2014/how-i-conceal-mailto-email-links-from-spam-bots/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:mailtoManager('example', 'example.com')">Contact</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
var link = document.createElement('a'); | |
link.target = '_blank'; | |
window.mailtoManager = function(local, domain) { | |
link.href = 'mailto:[email protected]' | |
.replace('truck', local) | |
.replace('thebots.com', domain); | |
link.click(); | |
} | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment