Do you hide email addresses to “spam bots” on websites?

后端 未结 7 812
-上瘾入骨i
-上瘾入骨i 2020-12-31 22:36

Although there are still bots harvesting emails, I\'m wondering if you hide email addresses on websites. I know this was common practice a few years back, but it seems that

7条回答
  •  耶瑟儿~
    2020-12-31 23:21

    You can hide your email address and display it using JS. This isn't also foolproof but offers some protection.

    Something like this should do the trick:

    contact me
    
    // in JS
    var parts = ['my', '.', 'email', '@', 'example', '.', 'com'];
    var elems = document.getElementsByClassName('mail');
    var len = elems.length;
    for (var i = 0; i < len; i++) {
        elems[i].href = 'mailto:' + parts.join('');
    }
    

提交回复
热议问题