This time I will share jQuery Plugin and tutorial about jQuery Plugin To Protect Email Addresses From Spambots – MailTo, hope it will help you in programming stack.
MailTo is a jQuery plugin that obfuscates/hides your email addresses on the webpage to protect them from crawlers and bots.
How to use it:
1. Download the MailTo plugin and include the minified version after jQuery JavaScript library.
1 |
< script src = "//code.jquery.com/jquery-1.12.1.min.js" ></ script > |
2 |
< script src = "jquery.mailto.js" ></ script > |
2. Add email’s account name, host name and subject using html5 data
attributes as follows:
2 |
data-account = "webmaster" |
3 |
data-host = "jQueryscript.net" |
4 |
data-subject = "Contact us" > |
3. Initialize the plugin and done. In this case, the plugin will display the email address ‘webmaster@jQueryScript.net’ with a ‘mailto’ link on your webpage.
4. You can also apply the plugin to any inline element like ‘span’.
2 |
data-account = "webmaster" |
3 |
data-host = "jQueryscript.net" |
4 |
data-subject = "Contact us" > |
5. Available plugin options.
07 |
host: window.location.hostname.replace( 'www.' , '' ), |
This awesome jQuery plugin is developed by sergiodlopes. For more Advanced Usages, please check the demo page or visit the official website.