Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibrarySecurity and Blocking

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Block Spambot Phone/Email Harvesting

Spambots are about. They harvest telephone numbers and email addresses from websites and store them in a database.

Then they spam the numbers and addresses from in their database with telephone calls, email, and text messages.

Some website owners don't publish their addresses and numbers on their websites because they don't want to be bothered. Others, especially business owners, want that information available to their prospective customers, yet they hesitate to publish it because of the spam problem.

A common compromise is using a form for people to get in touch. Because there are bots that automatically submit forms with their spam messages, many site owners resort to a form that can't be automatically submitted, like Spam-Free Form.

Most email address and telephone number harvesting robots are unsophisticated. They parse the source code of the web page, grab what they're interested in, and go on to the next URL. The bots might parse JavaScript. Yet few, if any, compile and run JavaScript.

By parsing JavaScript, I mean they are likely to find this email address because it is a simple parse:

var address = "name@example.com";

However, they are unlikely to find this email address:

var address = "name";
address += "@";
address += "example.com";

JavaScript with more obfuscation than the above example is virtually impossible to parse.

In addition to spambots, there is software out there that grabs an image of web pages. That image is scanned by other software to read email addresses, telephone numbers, and other information the software engineers may be interested in.

To get around that, the system presented in this article delays publishing and linking the email or phone data on the web page. Thus, an image made of the web page does not have that information.

Further below, you'll see a custom JavaScript code generator for delayed publication of obfuscated versions of your telephone number and/or email address. The number and address are linked so your reader can tap instead of copy.

When you see the code the generator provides, I think you will be well satisfied that spambots are unable to parse it.

First, here is a demonstration. Then, I will describe how to implement it for your contact or other pages.

Telephone: loading

Email: loading

Publishing of the above data was delayed 4 seconds. To view the delay, reload this page.

Spambot Block and Delayed Publication Implementation

Implementing the feature requires two things:

  1. The HTML code with places to publish the email address and/or telephone number.

  2. The JavaScript to maintain the obfuscation and to delay the publication of the data.

Let's get started.

The HTML to Publish the Phone/Email

The telephone number is published within an HTML container that has an id="-ph-content-" id and value. It may be a div container or a span container. (Or other HTML container, such as pre or td.)

The example on this page uses a span container.

Within the span container, before the telephone number is published, can be any content or no content at all. If it contains content, the content is replaced with the telephone number when the number is published.

The example on this page puts a "loading" icon into the span container. For clarity, here is the HTML tag being used for the example.

<span id="-ph-content-">
<img src="https://www.willmaster.com/images/working.gif" style="height:.8em;" alt="loading">
</span>

Wherever you put the HTML container for the telephone number is where the JavaScript will publish the number when 4 seconds have elapsed. (See The JavaScript Code Generator for the JavaScript.)

Publishing the email address is similar to publishing the telephone number. The difference is the id value. Use id="-em-content-" for the email address.

For clarity, here is the HTML tag being used for the example on this page.

<span id="-em-content-">
<img src="https://www.willmaster.com/images/working.gif" style="height:.8em;" alt="loading">
</span>

Here is the JavaScript code generator.

The JavaScript Code Generator

Use the generator below to generate the JavaScript your implementation will require.

Delayed-Publication JavaScript Generation

Email address:

Telephone number:

(generated code will be in box below)

The generator does not check for valid-formatted email addresses or telephone numbers.

Also, no customization is required for the above code, although you can make adjustments if you wish to.

Install the JavaScript by pasting the code into your web page near the bottom of your web page source code. Above the cancel </body> tag generally is a good spot.

When it's installed, it's ready to go.

Testing

When the HTML containers for either or both the linked telephone number and/or linked email address are in place, along with the JavaScript provided by the generator above, then the system should work.

Test it, of course. Tap the linked telephone number to see if your computer or device reacts as expected. And tap the linked email address to also check its reaction.

The generator in this article may be used for any telephone numbers and email addresses that you want to publish.

(This article first appeared in Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC