Unlike all pages on facebook in 2 minutes
Tags: console, facebookpages, facebook, javascript
Published: 2019-02-19 19:05:02

---
title: Unlike all pages on facebook in 2 minutes
published: true
tags: console,facebookpages,facebook,javascript
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*9qE6ABQsvsOKNi3V6KSx2w.jpeg)

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:

![](https://cdn-images-1.medium.com/max/983/1*jZOySnT7Prwq1SMOk-eZuQ.png)<figcaption>Likes Section</figcaption>

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.

![](https://cdn-images-1.medium.com/max/986/1*fr-DGd3iBGVT7B3SO0WinA.png)<figcaption>Developers tool</figcaption>

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');
```

![](https://cdn-images-1.medium.com/max/984/1*O4PBrxmMZ030Kfo8nHuWNw.png)<figcaption>Screenshot of console with code</figcaption>

Hit enter. And then write this command:

```
// trigger click on all 'Liked' Buttons, to get unlike popovers
for(let button of buttons){button.click();};
```

![](https://cdn-images-1.medium.com/max/986/1*hQZbrXcG8EswHIB6eL3Hbg.png)<figcaption>Another code in console</figcaption>

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){unlike.click();}
```

![](https://cdn-images-1.medium.com/max/982/1*U_a7roqEyDFPY-I5r54FOA.png)<figcaption>Final commands</figcaption>

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){button.click();};
```

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](https://dev.to/parthchokshi/remove-all-advertisers-and-targeted-ads-from-facebook-in-2-minutes-4am6)