Script to Remove Automatically Active Links in Blogger Comments

Table of Contents [Hide]

     Inputlearn.net -- The bad thing is that there are active links in our blog comments, which can cause bad things for our blog's health. Usually, active links in blog comments are aimed at embedded backlinks. However, the dynamic link will die with an automatic script that the admin will provide later (Broken Link).

    comment Link
    Comment Link

    Pairing this script can later avoid being targeted by random people, such as comment spam and placing active links carelessly in our blog comments.

    Related:  A new way so that blog articles can't be copied and pasted

    How to Hide Active Links in Blogger Comments

    In this case, there are 2 ways that you can choose, namely:

    1. Converting active links to plain text.
    2. Delete the entire content of the comment and replace it with an automatic message.

    A. Changing the active link into plain text

    There are 2 scripts, namely JavaScript and JQuery. Please choose according to your taste. Here is the script.

    1. Log in to your blogger using a Gmail account.

    2. Select the Theme menu ~ Edit HTML.

    3. Copy the script below.

    JavaScript

    <script> //<![CDATA[
    /* Hapus Link Aktif di Komentar by inputlearn.net */
    content = document.getElementById('comments').getElementsByTagName('p');
    for (var i = 0; i < content.length; i++) {
     if (content[i].innerHTML.indexOf('</a>') !== -1) {
     content[i].innerHTML = content[i].innerHTML.replace(/<a[^>]*>|</a>/g, "");
     }
    }
    //]]> </script>

    jQuery

    <script> //<![CDATA[
    /* Hapus Link Aktif di Komentar by inputlearn.net */
    $(function(){$('#comments p').find('a').contents().unwrap();}); //]]> </script>

    To install the script above, paste it above the </body> tag, select one, and save the theme.

    B. Delete the entire content of the comment and replace it with an automatic message

     For the second method, this is quite good. If spam comments on the blog don't connect, they will be automatically changed and removed from the comments column. Please copy the script below.

    Related: How to Create a Responsive Blogger Table of Contents

    The installation remains the same above the </body> tag

      <script> //<![CDATA[
    /* Hapus Link Aktif di Komentar by igniel.com */
    var content = document.getElementById('comments').getElementsByTagName('p');
    for (var i = 0; i < content.length; i++) {
     if (content[i].innerHTML.indexOf('</a>') !== -1) {
      content[i].innerHTML = 'Oops... you can't enter active links here, sis! Do you want to suck? Comments are automatically disabled by inputlearn.net';
     }
    }
    //]]> </script>

    You can change the words according to your heart's taste for the one I gave the color BLUE.

    So, those were some ways to Delete Automatically Active Links in Blogger Comments. Hopefully, it will be helpful to (Script Source: Igniel.com).

    Source: Inputlearn.blogspot.com

    Previous Post Next Post

    Contact Form