DEV Community

Parth Chokshi
Parth Chokshi

Posted on • Originally published at Medium on

Unlike all pages on facebook in 2 minutes

I was finding a way on how to unlike all the pages on Facebook at one go. After trying some different things out in console and looking at some chrome extensions, I figure out with just some commands you can unlike all the pages at one go. Here’s how to do it.

Firstly go to Likes section in your profile. Here’s the snapshot help:

Likes Section

Click the Likes link. And you will be redirected to the the likes page.

Then right click on your page anywhere and click inspect link in the menu. It should open a section beneath or on the sides on your browser.

Developers tool

Something like above. Click console in that and you should find a big warning saying — “STOP”. Ignore that. (Trust me! :D)

Now write this commands as listed below:

// Get hold of all 'Liked' Buttons
var buttons = document.getElementsByClassName('PageLikedButton');
Enter fullscreen mode Exit fullscreen mode

Screenshot of console with code

Hit enter. And then write this command:

// trigger click on all 'Liked' Buttons, to get unlike popovers
for(let button of buttons){;};
Enter fullscreen mode Exit fullscreen mode

Another code in console

This may freeze your screen for sometime. But don’t worry, hold on and don’t try to refresh the page. The reason is, it is triggering click event on all the Liked Buttons on the page. If you want to unlike all the pages, scroll to the most bottom part of the page — the part where you couldn’t scroll down anymore. This is to bring all the ‘ Liked’ buttons on the page view. The buttons who are in page view will only get that click event as other pages are not loaded into page yet as you haven’t scrolled down. Those only loads as soon as you start scrolling down.

In case you just wanna give it a shot to try, you don’t have to scroll down to the most bottom part. Just load the Likes page and run the commands.

Now time to trigger click on all Unlike popovers which would have appeared after running the above commands. So to unlike all of them at once:

// Get hold of all the unlike links
var unlikes = document.getElementsByClassName('itemLabel');
// trigger click on all unlike popovers
for(let unlike of unlikes){;}
Enter fullscreen mode Exit fullscreen mode

Final commands

So we are triggering click on all the unlike links that are appearing at once. And this should unlike all the pages that are present on view port.

WARNING : This will unlike all the pages that are present on the page at that time.

But hey, we can always undo the things, can’t we??!! Yes we can.

Just run the following two commands. And that will like all your pages back at one shot.

var buttons = document.getElementsByClassName('PageLikeButton');
for(let button of buttons){;};
Enter fullscreen mode Exit fullscreen mode

Bingo! Yes, the pages are liked back again. Give it a shot.

I also wrote a blog to remove all advertisers and targeted ads from facebook.

Remove all advertisers and targeted ads from facebook in 2 minutes

Top comments (1)

vedant15188 profile image
Vedant Kashyap

New UI has been rolled out to everyone! Sorry mate, this no longer works.