• Home
  • About me
    • SEO (Search Engine Optimization)

    • Blogger Tips Tricks

    • TEMPLATE

    • ECOMMERCE

    • TV Channels Freebies

    • DESIGN

    • MOVIES

    CREATE A BAD WORD FILTER IN BLOGGER COMMENT

    In your blog ,have you ever seen the bad word in comments ? Does it get annoyed other readers ? If the answer is yes ,you may need this one . I created a script for filtering bad word in comments .You just need to make a list of bad words ,and all the words in this list will be replaced with *




    How we do that ?

    1,Go to Blogger Dashboard -> Design ->Edit HTML .Checked on Expand wiget templates . Backup template before making any changes .



    2,Find <body> and add this code right before

    <script type='text/javascript'>
    //<![CDATA[
    function badwordfilter(ID){
    var comm = document.getElementById(ID);
    var comment = comm.innerHTML;
    var reBadWords = /badword1|badword2/gi;
    comment1 = comment.replace(reBadWords, "****");
    comm.innerHTML = comment1;
    comm.style.display = "block";
    }
    //]]>
    </script>


    please pay attention to the text in black bold above,it's the list of bad words .You can add more word to this list and separate each of them with a | ,like this

    badword1|badword2|badword3|....|...

    do not remove / at the start and /gi at the end .



    3,Find and replace



    <p>   <data:comment.body/></p>


    with



    <p>

                                                                                     <div expr:id='data:comment.id' style='display:none;'>

                                                                                         <data:comment.body/>

                                                                                     </div>

                                                                                     <script type='text/javascript'>badwordfilter(&quot;<data:comment.id/>&quot;);</script>



    That's all .Save template and see the changes

    Filed Under:

    About the Author

    My name is Homer Oston. I made this template in magazine style and named it Blogger X Design .I hope it helpful to persons who want a solutions for a template in Blogspot.To download this template and see template install instruction ,go to Blogger x Design blog.

    Leave a Reply