jQuery Plugin To Protect Email Addresses From Spambots MailTo - Download jQuery Plugin To Protect Email Addresses From Spambots - MailTo

Download jQuery Plugin To Protect Email Addresses From Spambots – MailTo

Posted on

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.

jQuery Plugin To Protect Email Addresses From Spambots MailTo - Download jQuery Plugin To Protect Email Addresses From Spambots - MailTo
File Size: 5.1 KB
Views Total: 1323
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

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:

1 <a class="email"
2    data-account="webmaster"
3    data-host="jQueryscript.net"
4    data-subject="Contact us">
5 </a>

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.

1 $('.email').mailto();

4. You can also apply the plugin to any inline element like ‘span’.

1 <span class="email"
2    data-account="webmaster"
3    data-host="jQueryscript.net"
4    data-subject="Contact us">
5 </span>

5. Available plugin options.

01 $('.email').mailto({
02  
03   // By default link text is the email address
04   text: false,
05  
06   // Default host
07   host: window.location.hostname.replace('www.',''),
08  
09   // Account
10   account: false,
11  
12   // Prepend email address
13   prepend: false
14    
15 });

This awesome jQuery plugin is developed by sergiodlopes. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net