Skip to content
Related Articles

Related Articles

Improve Article

How to auto like all the comments on a facebook post using JavaScript ?

  • Last Updated : 07 Aug, 2020
Geek Week

In this article, we are going to learn how to like all the comments on a Facebook post automatically. Many times we want to like all the comments of friends on our post or on any other’s post, so this script helps us to save our time and effort by automatically liking all the comments on the post.

Approach:

  1. Make a variable comments that points to an array of all the comment on the post.
  2. Run a loop to iterate all the comments.
  3. Now we check if the comment is not already liked.
  4. Then click on the like button of that comment.

Below are the steps:

  • Go to facebook page using m.facebook.com
  • Sign in and open any post.
  • Open developer mode in Chrome by pressing Ctrl+Shift+I
  • Navigate to the console.
  • Now, run the below script.




    var comments =document.getElementsByClassName("touchable _2b0a");
    for(var i=0;i<comments.length;i++)
    {
        if(comments[i].style.color != "rgb(32, 120, 244)")
        {
            comments[i].click();
        }
    }

Output:

Output

Note: Please ensure that there is a stable internet connection available so that the script runs smoothly. Also ensure to visit facebook with m.facebook.com not www.facebook.com because this script works on mobile version of facebook only.

This tutorial is for educational purpose only, please don’t use it for disturbing anyone or any unethical way.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up