How to show email addresses on the website to avoid spams?

In the past I have seen this done with javascript. Basically you assign the email address to javascript variables and change the contents of an element using these. You can also provide a fallback for users with javascript disabled which points them in the direction of a form if you need to. Here’s an example

var user="foo",
    domain = 'bar.com',
    element = document.getElementById('email');

    element.innerHTML = user + '@' + domain;
    //OR
    //'<a href="https://stackoverflow.com/questions/23002711/mailto:" + user + '@' + domain + '">Email</a>'  

This way bots never see the email address as they do not load javascript.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)