How can I obscure a telephone number from harvesting bots (or whatever they're called) like one can with an email address? Or is it necessary?
| SitePoint Sponsor |

How can I obscure a telephone number from harvesting bots (or whatever they're called) like one can with an email address? Or is it necessary?

If it is in the web page where people can see it then the bots can too. If you don't want bots to see it then don't place it in a page the bots can access.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">


I guess you could at least use an image; although, since real people can read it, they can then do with it what they please.


That leaves me thinking that I will leave off the national code bit (01925 UK No.) and put it at the end as "zero, one, nine, two, nine.
What about that idea?

If the spammer can read it in the page then they can add it into their autodialer. Just because their spambot isn't able to extract the phone number automatically doesn't mean it can't tell there is a phone number there and report the page for manual extraction.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
I'm thinking it would make little sense to spend time and money to build a bot which harvests phone numbers, when an autodialer can easily go through every possible phone number.

It might if you wanted to target a specific industry.
Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
Fair enough - but then, wouldn't it be easier to find the numbers on the websites yourself, rather than writing a bot which can analyse a websites contents to figure out which industry it belongs to?![]()

Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">

I have put the final (local) part of the number next to the respective position and the national code elsewhere. I seemed to have been worrying about nothing as I thought there were harvesters out there. A reader would pick up the first part before the rest.

I wouldn't say there aren't harvesters out there, because there are, however the chances are you are unlikely to get spammed via the phone because in the UK the telephone networks are much more restrictive about people who start mass dialling phone numbers, in fact the network operator would more than likely involve the police in cases of fraud or autodialing sales services. I know BT would dump them on one of those call blocking systems so it would be filtered.
Bookmarks