How to like multiple posts on facebook news feed automatically using JavaScript ?

In this article, we are going to learn how to like multiple posts automatically on the Facebook news feed. Many a time we waste too much time in liking all the posts in our news feed. So this script will help to reduce our time and effort by automating this task.


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

Below are the steps:

  • Go to facebook page using
  • Sign in and open the news feed/homepage.
  • Open developer mode in Chrome by pressing Ctrl+Shift+I
  • Navigate to the console.
  • Now, run the below script.





    var posts = document.getElementsByClassName("_15ko");
    for(var i=0;i<posts.length;i++)





Note: Please ensure that there is a stable internet connection available so that the script runs smoothly. Also ensure to visit facebook with not 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.


My Personal Notes arrow_drop_up

I am persuing Btech in CSE from Madan Mohan Malaviya University of Technology, Gorakhpur 6 star on codechef(handle - gjaiswal108) with rating 2215(max) I love competitive programming and participate in various online contests My other interests are in web scraping and web development

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.