Today's Question:  What weekend projects have you created?        GIVE A SHOUT

How do you filter spam comments on you website or blog?

Nowadays, one maintenance job of website and blogs is to delete spam comments. They are mostly some advertisement which are not related to your website or blog content. It's annoying that we need to delete them again and again. We know that there are some third party spam comment filer can be used. But we just want to know what do you use to filter spam comment or you just don't care about them? We want to hear about your story.



There are some ways we can slow down the spam comments. But it's difficult to eliminate them completely.

  1. We can detect whether a request is from POST, GET etc or from AJAX or not;
  2. We can check the time for the page loading and time for form submission. If it's submitted by a robot, then the process is very fast. So you can set a threshold to check if the time spent is less than the threshold, it will be treated as a spam comment;
  3. Robot loves text field, when they find a text field, they will try to fill up that field. We can think other way around, we add one field which uses CSS to set its display:none to hide it and we check the value to be empty when the form is submitted. If the field has a value, then we treat it as a spam comment.
  4. We can have some word filter, we can build a list of banned words, they are mostly some sensitive words or some advertisement words like Gucci etc. If we find these kinds of words in the comment, then we treat it as spam comment.
  5. You may also check the user agent string on the server side, but this can be faked easily. They are not very useful but can filter some of them.
  6. We can also adopt the login mechanism if we want the user to comment after he registers. This will also effectively block some spam comments.
  REPLY  Posted by at 2013-01-19 19:01:23


Sorry! You need to login first to post answer.


Login with Facebook Login with Twitter

Back to top