Socket
Socket
Sign inDemoInstall

spamguard.js

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    spamguard.js

🤖 Protect your email address from being crawled by spam bots.


Version published
Maintainers
1
Created

Readme

Source

spamguard.js

Installation

npm install spamguard.js
yarn add spamguard.js

Usage

spamguard(selector);
<script src="https://cdn.jsdelivr.net/npm/spamguard.js/dist/spamguard.js"></script>
<a href="#" class="obfuscate-it" data-name="mark" data-domain="gmail" data-tld="com" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>

Demo

Options

AttributeType DefaultDescription
data-namestringEverything before the @ of your email address
data-domainstringDomain name without extension
data-tldstringExtension without .
data-saltstringAdditional characters for confusion, which are removed
data-numberstringYou can add letters and special characters for obfuscation (see example)
data-mailtobooleanfalseCreates a mailto:-link
data-contentbooleanfalseWhen true, your own content will be kept. Otherwise it returns the email address.
data-subjectstringSet a custom subject for mailto:-link
data-messagestringSet a custom message for mailto:-link
data-textstringObfuscate a custom string
data-protocolstringtelSet the protocol on data-number: whatsapp, tel, sms
data-align-contentstringleftCorrespond to justify-content

Example with custom content

<a href="#" class="obfuscate-it" data-name="mark" data-domain="gmail" data-tld="com" data-mailto="true" data-content="true">
	<i class="fa fa-heart"></i>
</a>
<script>
	spamguard(".obfuscate-it");
</script>

Example with phone number

<a href="#" class="obfuscate-it" data-number="_+1 $&80=8 :555;; 01-))23" data-salt="§$%&/()=_:;.-[]" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>

Example with WhatsApp number

<a href="#" class="obfuscate-it" data-number="_+1 $&80=8 :555;; 01-))23" data-salt="§$%&/()=_:;.-[]" data-protocol="whatsapp" data-message="Hi there!" data-mailto="true"></a>
<script>
	spamguard(".obfuscate-it");
</script>

Example with a custom text

<span class="obfuscate-it" data-text="H$e__l-[l].o ::W=o)r%&%ld.!" data-salt="§$%&/()=_:;.-[]"></span>
<script>
	spamguard(".obfuscate-it");
</script>

Keywords

FAQs

Last updated on 12 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc