We want to make it hard for bots to get our email addresses, but as simple as possible for normal users. With these few lines of JavaScript we decode the email address and set the href attribute in the HTML link. We are using the atob method to decode a string of Base64-encoded data. An alternative is to use some basic encryption algorithm like the Caesar cipher. It is fairly straightforward to implement in JavaScript. It's more complicated for bots.

5m read timeFrom css-tricks.com
Post cover image
Table of contents
The traditional caseThe HTML approachThe HTML & CSS approachThe JavaScript approachThe embedded form approachConclusion
1 Comment

Sort: