https://github.com/jalbam/easpm123
[EASPM123 (Email Anti-Spam 123)] An Easy-to-use JavaScript API that protects any email address you want to use in your website from spambots.
https://github.com/jalbam/easpm123
configurable cross-browser cross-device cross-platform easy-to-use email-obfuscator email-protector javascript javascript-api javascript-library js multilang multilanguage multiplatform spam-prevention spam-protection spambot-security vanilla-javascript vanilla-js vanillajs
Last synced: 6 months ago
JSON representation
[EASPM123 (Email Anti-Spam 123)] An Easy-to-use JavaScript API that protects any email address you want to use in your website from spambots.
- Host: GitHub
- URL: https://github.com/jalbam/easpm123
- Owner: jalbam
- License: other
- Created: 2016-08-13T04:13:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-24T07:31:32.000Z (over 5 years ago)
- Last Synced: 2024-11-10T09:05:18.421Z (6 months ago)
- Topics: configurable, cross-browser, cross-device, cross-platform, easy-to-use, email-obfuscator, email-protector, javascript, javascript-api, javascript-library, js, multilang, multilanguage, multiplatform, spam-prevention, spam-protection, spambot-security, vanilla-javascript, vanilla-js, vanillajs
- Language: JavaScript
- Size: 52.7 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.htm
- License: LICENSE
Awesome Lists containing this project
README
EASPM123 - test page (by Joan Alba Maldonado)
<!--
//Changing options (it will be executed automatically when the document is loaded):
EASPM123(
true, //Auto-load when the document is ready.
["easpm123_"], //Classes used by A tags.
["easpm123_label_"], //Classes used by without-no-spam label tags.
["easpm123_", "easpm123_no_spam_"], //IDs used by A tags.
["easpm123_label_", "easpm123_no_spam_label"], //IDs used by without-no-spam label tags.
["NO_SPAM_WELCOME", "DELETE_THIS"], //Texts to be cleared (case sensitive).
["{*AT_HERE*}", "{*HERE_AT*}"], //Texts that will be replaced by AT (@) symbol.
["mouseover", "click", "touchstart"] //Events that will fire the script (leave it empty to do it automatically without events).
);
/*
//Changing options (it will be executed automatically when the document is loaded):
EASPM123(
true,
["easpm123_auto"],
["easpm123_auto_label"],
[], //If it was set to null, it would use default values and we don't want that.
[], //If it was set to null, it would use default values and we don't want that.
null,
null,
[]
);
*/
// -->
EASPM123 (E-Mail Anti-Spam 123) 1.0
by Joan Alba Maldonado
What does it do?
This script will help you to avoid spam by using JavaScript and will protect you even with JavaScript disabled.
Protecting your email address against spam is very important since as soon as your email address is caught by a spam bot and inserted in a list or a database for spamming purposes, it will be sold to many spammers that will annoy you and make you waste working time and lose hours and hours of your life. If just only one spam bot gets your email address, that can totally destroy your business if you are out of luck.
By default, when the script is added to a web site, it will be executed as soon as the document is ready and with the default values (read usage below to configure this behaviour).
For users with JavaScript enabled, they will see your email links normally (unless you use maximum security) and in a totally transparent way. So they will just need to place the mouse cursor or the finger above the email in order to see it and email you.
For users without JavaScript enabled, they will still be able to guess your email address as long as they are not bots. This is done by using a real email but with a text string added that the user will have to strip manually.
Some spam bots do support JavaScript. The script is executed some milliseconds after the document is ready to avoid some spam bots that get the emails from the documents as soon as they are ready without waiting at all.
Even though there are some spam bots that support JavaScript and will wait some seconds after getting emails from a document, not all of them are capable to fire user events. To provide a good security level, the script uses onMouseOver, onTouchStart and onClick events by default. You can change those events (read usage below) or even decode all emails automatically when the document is ready and without waiting for any user event (for the sake of security, this last option is not recommended).
Using maximum security (see live examples below) to avoid all spam crawlers (with or without JavaScript support) is recommended.
This method will work in any web browser under any platform, with or without JavaScript support. The script will work in any modern JavaScript browser and even in old ones (including Internet Explorer 5.0) as long as they have DOM support (document.getElementById and so on).
The script is lightweight, just around 2.57 KB (minified but not compressed).
Usage
To use this script, you just need to follow Step 1 and Step 3. Step 2 is optional just in the case you want to use change the default behaviour.
Add the script (recommended inside the HEAD tag) with the following code:
<script language="javascript" type="text/javascript" src="easpm123.js"></script>
Note: unless you change the script code, it will be executed automatically with the default values as soon as the document is ready.
[Optional] After adding the script (step 1), you can change the default behaviour executing the script configured with your desired values by adding the following code (recommended inside the HEAD):
<script language="javascript" type="text/javascript">
<!--
EASPM123(
boolean, //Auto-load when the document is ready.
//Note: Next values can be set to null for default or use [] if you don't want any:
strings_array, //Classes used by A tags.
strings_array, //Classes used by without-no-spam label tags.
strings_array, //IDs used by A tags.
strings_array, //IDs used by without-no-spam label tags.
strings_array, //Texts to be cleared (case sensitive).
strings_array, //Texts that will be replaced by AT (@) symbol.
strings_array //Events that will fire the script (leave it empty to do it automatically without events).
);
//-->
</script>
Example:
<script language="javascript" type="text/javascript">
<!--
EASPM123(
true, //Default is true.
["no_spam_class1", "no_spam_class2"], //Default is ["easpm123"].
["no_spam_label_class1", "no_spam_label_class2"], //Default is ["easpm123_label"].
["no_spam_id1", "no_spam_id2"], //Default is ["easpm123"].
["no_spam_label_id1", "no_spam_label_id2"], //Default is ["easpm123_label"].
["NO_SPAM_WELCOME", "DELETE_THIS"], //Default is ["NO_SPAM_WELCOME"].
["{*AT_HERE*}", "{*HERE_AT*}"], //Default is ["{*AT_HERE*}"].
["click"] //Default is ["mouseover", "click", "touchstart"].
);
//-->
</script>
Wherever you need to use a link to an email address, use the desired class or the desired ID for the A link. Using a label element (can be SPAN, DIV or whatever) is recommended for browsers without JavaScript enabled:
AQUI LINK Y LABEL
Note: You can improve security by using other methods as changing text direction by CSS (not recommended for browsers which doesn't support this CSS feature), use an image for parts of your email, etc.
Live examples
Here are some ways you can use to prevent spam:
email@NO_SPAM_WELCOMEexample.com
(without NO_SPAM_WELCOME)
(PUT THE MOUSE CURSOR OVER THE EMAIL OR CLICK/TAP IT!)
License
Forbidden to use without keeping the author's name and copyright clauses. For non-commercial purposes only (unless you contact me and pay for a license).
Contact me
email@NO_SPAM_WELCOMEexample.com
(without NO_SPAM_WELCOME)