Guard email addresses from being simply scraped by bots.
npm install email-obfuscateGuard email addresses from being simply scraped by bots.
http://dunckr.github.io/email-obfuscate/example/
Email addresses are harvested from websites using web scrapers.
There are many strategies that can be employed to mitigate scrapers:
1,
2,
3,
4.
However, it must be noted that preventing scraping is an arms-race.
This library's aim to prevent searching for ``mailto` links or using email address regexes.
It does this by constructing an email address from an object then drawing the text as an image using the canvas.
For older browsers without a canvas (IE8) we append an element using the alternate text.
`sh`
npm install email-obfuscate --save
`js
import EmailObfuscate from 'email-obfuscate';
var el = document.getElementById('email');
EmailObfuscate(el, {
// Email construct: name@domain.tld
name: 'test',
domain: 'example',
tld: 'com',
// Alternate Text
altText: 'Email'
});
`
#### el
Type: HTMLElement
The element to replace with EmailObfuscate.
#### options
##### name
Type: string test
Default:
The name portion of the email address to use (name@email.com).
##### domain
Type: string example
Default:
The domain name portion of the email address to use (name@email.com).
##### tld
Type: string com
Default:
The top-level domain portion of the email address to use (name@email.com).
##### altText
Type: string Email
Default:
The alternate text to use to represent the email address.
`sh`
npm run start
`sh`
npm run test
`sh``
npm run build
MIT © Duncan Beaton