-->

Ads 720 x 90

Automatic Script Deletes Active Links at Blogger Comments

Automatic Script Deletes Active Links at Blogger Comments
QUX.ME, Tutorial - Inserting the active link in the comments column is actually not good. Most of those who do it aim to plant backlinks. If later the link is dead and inaccessible or changed to a broken link, it will be bad for the health of the blog.

Instead of your blog being an easy target for spammers who like to spread links carelessly, it is better to prevent it from now using the script that I will share.

How to Hide Live Links at Blog Comments

There are two methods you can choose, namely:
1. Deactivate the link and change it to text.
2. Erase the entire contents of the comment and replace it.

1. Deactivate the Link and Change to Text

Each active link that is inserted will be turned off and only become text without changing the contents of the entire comment.

There are two types of scripts that you can try, namely pure Javascript and jQuery. Select the one that best matches and save "BEFORE / ABOVE" </body>.

1.1. Javascript

<script>
//<![CDATA[
/* Delete active link in comment by QUX.ME */
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>

1.2. jQuery

<script> //<![CDATA[
/* Delete active link in comment by QUX.ME */
$(function(){$('#comments p').find('a').contents().unwrap();});
//]]> </script>

2. Delete the entire contents of the comment and replace it

This method is very good because spam comments usually do not connect with the contents of the blog, so it's better that all be deleted and replaced.

There is only one type of script, Javascript only. Fill in the warning message you can change at will.

<script> //<![CDATA[
/* Delete active link in comment by QUX.ME */
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 the active link here bro! Comments are disabled automatically by QUX.ME';
 }
}
//]]> </script>

These are some of the ways you can try to hide or turn off active and live links in the Blogger comment column so that no more spammers are hanging around.

RELATED POSTS

Subscribe Our Newsletter