Spam Prevention/Reduction - Contact Form?

后端 未结 13 1617
余生分开走
余生分开走 2020-12-01 03:36

I want to add a simple Contact form to my web site so that customers can contact me easily.

NAME
13条回答
  •  佛祖请我去吃肉
    2020-12-01 04:26

    If you want to do a completely front-end solution I have had success recently by leaving the form action attribute blank, and populating it via a $(document).ready function. Most spambots use a browser that has javascript disabled, or are looking for hidden fields to avoid detection.

    Example:

    Your html would be:

    
    

    and anywhere in that page you can use this to populate it.

    
    

    A bot browser with no javascript will not get a form action, and they will get a 404 upon submission. Anyone with a normal browser (unless they have JS disabled for paranoid reasons) will get the normal behavior.

提交回复
热议问题