Expand All Facebook Comments

I have written a bookmarklet that expands all comments and replies in Facebook posts. This applies only to the full version of the Facebook website, not to versions of the mobile app.

Bookmarklets are not the prettiest or best-understood things in the world, but I’m making it available in case people want to use it.

To install or update the bookmarklet, click here to bring up a page with the bookmarklet in it, along with some simple instructions.

Also see my Link Comments bookmarklet.

What does this help with?

This expands Facebook posts so that you can see/read all comments and replies from top to bottom without clicking.

To isolate a single post to a browser tab, ctrl-click on the post’s time stamp, which is a permalink URL. Then, run the bookmarklet on the isolated post by clicking on the bookmark. Or, run the bookmarklet on multiple posts (e.g., search results in a private group) and it will expand all posts it finds.

2016-07-09 update. The permalink URL to a public page (for celebrities, businesses, etc.) stopped isolating the post; now the whole news feed is displayed with the post of interest at the top. If a page like this is encountered, this bookmarklet only expands the permalinked post. Facebook has changed how they do this at least twice now; I’m trying to keep up.

Facebook sometimes goes into theater mode (i.e., one post rendered on top of the news feed). This bookmarklet will close theater mode before expanding. For best results, be sure you have isolated the post to a separate tab.

Details of what this does

Output is logged to both a temporary visual text area and to the browser console. The text area goes away when it’s done, so if you want to see a record of what happened after-the-fact, you’ll need to hit F12 and open the browser console. When the script completes, it logs a numerical total of all comments and replies being displayed. New text goes to the top rather than the bottom.

The bookmarklet clicks on the following links, sequentially. That is, it clicks and waits for the new content, which is recursively checked for new links:

  • View more comments
  • View previous replies
  • View more replies
  • View [x] more replies
  • [x] replies
  • [user] replied

After all the comments and replies are obtained, it clicks any and all See More and See Translation links.

It finds links to click by querying on CSS style names and is thus language independent, but see the Warnings ahead.

Please don’t do this

This isn’t recommended on posts that have many thousands of comments:

  1. You probably aren’t really interested in posts with that many comments.
  2. I have found that Facebook stops delivering comments after a certain point; you can click the View more comments link, and nothing happens (visually, anyway). This bookmarklet bumps into the same limitation: it iteratively clicks View more comments links and eventually time out as nothing happens.

That said, you still might want to try this, if you are searching for a specific person’s comment or reply among many. Just be aware that eventually Facebook stops delivering comments.

If you want to stop the bookmarklet, hit ESC.

Customizing the bookmarklet

You can customize what the bookmarklet does. You can create multiple bookmarklets, each with a different customization.

When you edit the bookmark (Properties in Firefox), you will see near the very beginning todo=14. You can change the numerical value. With this value, you control four bits of instruction:

  • 1: open Continue Reading links
  • 2: expand comments
  • 4: expand replies
  • 8: click on any translation links

In combination, there are 16 possible values: 0 through 15. Some examples, starting with a value of 14:

  • Add 1 to open Continue Reading links
  • Subtract 4 to not expand replies
  • Subtract 8 to remove the translation step

Note that I only regularly use (hence, test) the default value.

Browser support

I mostly use the Google Chrome browser on a Windows PC, and I don’t use mobile devices. Among the main browsers, bookmarks in Chrome were the easiest and most intuitive to use.

Mozilla Firefox also works, though getting the bookmark bar to show up is slightly more cumbersome.

I tried Microsoft Edge once just to make sure things seem to work there (which they did). Bookmarklets in Edge was a complete hack through the file system; really, not supported.

Why did I do this?

I looked around to see if someone else had done something like this already, and of course I might have missed something, but it became apparent to me that it would be easier to do this myself than to keep looking for something that actually worked.

Warnings and notes

  • This works today based on how Facebook is rendered in HTML today. It might break tomorrow, and I might not be able to fix it.
  • Though the script doesn’t outright parse display text, it attempts to parse integers as a way to avoid clicking Hide links. I have tried about 10 different languages, all of which worked (I think). Please let me know if you find a problematic language, such as where the script shows and hides replies endlessly.
  • You can run the bookmarklet multiple times; it’s harmless. Sometimes it helps to do this if Facebook is slow and timeouts result in an incomplete expansion.
  • If you want to see the bookmarklet’s JavaScript in a readable format, copy-and-paste it into a beautifier such as jsbeautifier.org. In fact, if you know JavaScript, you might want to do this to boost your confidence that I am not trying to hack you with some malicious script.

108 thoughts on “Expand All Facebook Comments”

  1. Hello, do you accept donations? I had this from a while back and noticed my version didn’t do “x comments” links – I searched for a replacement and instead found the updated version. 🙂

    1. All your base posts (even ignoring comments) are so long, Facebook will only display them in separate tabs (in English, the link that indicates this is ‘Continue Reading’). In terms of automatically expanding everything, this can’t do it; browser security prevents this from operating across different tabs.

  2. Dear author,
    this script works great normally, but when come to this scenario, it’s expected to make a bit version change to support better, the scenario as beneath:
    recently a period of time later after joined a facebook group, i’d like to start read the whole threads/posts within it. so i scroll down until the creation of the group;
    now we can imagine that it’s quite a bit large for the web-page, since it’s already loaded the group’s whole surface content, it’s around 40MB size, i’m using windows7 64 bit, with 8GB RAM; i found that the script working from up to down, since it will load more and more hidden contents, so we can imagine the web-page is hardly load any more, which causing the down side of the web-page can’t be handled via this script. and after tried at least 5 times, the reality is exactly the same as the imagination.
    so the expectation here is:
    can the script modified to working from down to up(reversely as currently)?
    so that in this kind of scenario, we can expand the whole group’s hidden contents via 2 times, 1st via the current script, and the 2nd via the expected version, apparently, this method still needs some manual supervision to let these 2 times meet in the middle, or overlap a bit to ensure the overall object be met.
    Thanks for the consideration.

    1. This script just automates clicking. If it runs out of memory or slows down to the point of stopping or simply stops responding (and this is my experience with Facebook), it’s the same whether you click manually or use this script.

      1. yup, i know it’s the same whether i click manually or use this script to cause the out of memory or just stop nearly;

        and that’s exactly the reason i think the reverse handling can to some extent fix this issue, it’s just a game of try to reach the middle point between up side & down side, just as ctrl+f in chrome to search, f3 means from up to down, and shift+f3 means from down to up(just take a reverse);

        so i think maybe can take it as the example to inspire something for the script.

  3. A Rookie here so I please don’t tech talk over my head. I have a Facebook post with over 60k shares. I normally thank people that share my post but FB bogs down when I scroll down with this many. I was thinking if I could close all the comments I could scroll to the bottom one and work my way up. Does that make sense? Will this product do that? Thanks – Bob

  4. This is/was by far the most used item in my bookmark bar for quite a long time, and saved me countless hours of manually expanding comments, etc… However, it seems Facebook did something in the past 24 hrs that now prevents this from working. I haven’t yet had time to dig into your code to try to fix it myself, but I was wondering if you might know of something off-hand to check, perhaps something simple that may have changed? I only ask because I’m not one to just go and ask someone to fix something lol.

    That aside, this was such an amazing find, and you did absolutely beautiful work!!

      1. You most certainly did!! You are officially my favorite person of the week!! Thanks again SO MUCH for going through the work to write this! 🙂

  5. I have a Facebook post with 8500 comments when I run this it stops working at around 1400 comments is there any way I can get to see the remainder of the comments?

    1. Not that I know of. This script just automates clicking. If it runs out of memory or slows down to the point of stopping or simply stops responding (and this is my experience with Facebook), it’s the same whether you click manually or use this script.

  6. FANTASTIC script! Fast and flawless.

    I had manually done a long, long page, then found this, ran it, and saw I had missed some!

    Needed to archive the page, entire page.


        1. That would involve a completely different approach and different project, with different maintenance concerns. I have no plans to do that.

          1. Do you mean expanding comments on a third-party site? That’s not something I’m going to work on.

Leave a Reply

Your email address will not be published. Required fields are marked *