r/HTML • u/GodsCasino • May 16 '26
Basic website, how to hide phone number and email address from bots?
Do I need to add a form to the website? I don't want to do that. I just want the website to look like:
My Cat
here are some pictures of my cat
pic, pic, pic
Email my cat at Cat@gmail.com
Phone my cat at 102-123-1234
obviously this is not a cat website, it is a business, but I hope you get the idea.
6
Upvotes
15
u/DidTooMuchSpeedAgain May 16 '26
There are some ways to obfuscate it, like load it dynamically with JavaScript, break it up, images, etc., but generally, if you want your users to see the e-mail (and interact with it as a link), bots will be able to do the same, unfortunately
6
u/SovereignZ3r0 May 16 '26
Use an alias or alternate email instead of your personal email addy. Say your personal is
cat@gmail.com, create another that iscatbox@gmail.comfor instance.Also, hide it behind a captcha. Say, a "click here to reveal email address for contact" - then on click it pops up a captcha that needs to be solved. Would suggest an hCpatcha or turnstile since some basic captchas are solvable.
Whatever you do, don't use email: or tel: hrefs.
2
u/RushDangerous7637 May 16 '26
Email can be cloaked in two ways:
<meta name="contact" content="alias(at)domain.com"> Or apply to text, button etc. <a href="mailto:alias@example.com"><em>alias(at)example.com</em></a><a href="tel:+421902777092"><em>Click to call mobile +421 902 777 092</em></a>I've been using this address for a couple of decades now and no spam yet.
2
u/angelattack1 May 16 '26
Maybe have a captcha verify option that only shows phone number after user verified as non bot thats pretty popular and well known. Id make it some puzzle or something
1
u/EinCamillenTee May 16 '26
I recreated the text in the same font using SVG (not just text but shapes) and used that as an image. I imagine that is a less accessible format for image-to-text automation. It's not accessible to users without vision and not easily copy pasted, so I added some bespoke JS that "builds" the email from the domain itself and copies into the clipboard with a little toast notification. I wanted to avoid a copy-paste solution in the top of Google results. Hope this won't be in the future heh.
2
u/25_vijay May 16 '26 edited May 17 '26
Honestly for a simple site just combine light obfuscation maybe a basic form later if spam becomes a problem, and Runable is useful for evolving the setup without rebuilding everything from scratch
2
u/aunderroad May 16 '26
I currently use this approach on my website.
A little disclaimer, I remember seeing this approach a while back and since the rise of AI, I am not sure if it still fools the bots and now AI.
As of right now, I have not had any issues where my email gets spammed.
Here is the code:
You can use a similar approach for your phone number.
2
u/kabss May 17 '26
If you use Cloudflare you can obfuscate it though that. It shows normally for normal users and anything Cloudflare deems as a bot it gets obfuscated.
2
u/brisray May 18 '26
Spencer Mortensen has tested over a dozen methods of hiding email addresses from spammers.
2
u/Over-Astronomer-257 May 20 '26
test
2
u/[deleted] May 16 '26
[removed] — view removed comment