Expand All Facebook Comments

I have written a bookmarklet that expands all comments and replies in Facebook posts. This applies to the full version of the Facebook website. 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 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.

Also, Facebook sometimes goes into theater mode (one post rendered on top of the news feed). If this happens, hit ESC to go back to the main feed before expanding.

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.

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.

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:

  • First, you probably aren’t really interested in posts with that many comments.
  • Second, 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 will iteratively click the View more comments link 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.

As you’re creating or editing the bookmarklet, you will see near the very beginning todo=15. You can change the single-digit numerical value. With this number, you control four bits of instruction:

  • 1: expand the post itself (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 15:

  • Subtract 4 to not expand replies
  • Subtract 8 to remove the translation step

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

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.

92 thoughts on “Expand All Facebook Comments”

  1. thanks

    can you please find solution to expand see more and continuo reading in posts not only in comments

    2. if you type in facebook search posts liked by me or by any of you friend you will see all posts in the page

    but your code only expand the comments for the first posts can you make it expand all posts when you scroll down

    1. I might not understand your request(s), but if I do, I’m not ready to try taking this in that direction. I’m going to stick with expanding just one post at a time that you’re actually interested in reading — not your whole news feed, and not a complete search results “feed.” Feeds are “infinite” (until the beginning of Facebook time), so I’m not sure how realistic that is, anyway.

      Still, good point about the post itself maybe being closed up. I’ve never seen that require more than one click (it’s not paged, or recursively closed up), but okay, that’s still one click. I’ll see if I get to that.

    2. I’ve modified the bookmarklet to click any See More link in the post itself.

      As far as I can tell, when a post has a Continue Reading link, that link is the same as the time stamp permalink URL: it isolates that single post and opens it in a separate window.

  2. thanks for your help please type in your facebook search: posts liked by me to see what i mean

    i want to expand all comments in all posts like if you try it in any profile it will expand all comments if you scroll down i really need this

    in your first code your code only expand first posts in search result feed is it possible to make this code expand all the posts its not infinite some times there are 10 posts some times 100 if you scroll down result will be more why you code expand all posts and comments if i scroll down in any profile not only one posts and it cant expand all posts and comments in search feed when i scroll down

    2. about Continue reading can you show full posts in the same page if not can you make code to open every posts with continue reading in separate window automatically so imagine in your profile if you scroll down to your old posts you find 10 posts with continue reading i want this code to open all Continue reading posts in separate window is it possible for you

    1. Sorry, but I don’t think I’m going to expand this to handle multiple posts in one page. Thanks for getting me to think about it, though. I’ve learned a few things.

      I actually wasn’t aware of the sloppy power of Facebook search. I tried “posts liked by me” and it returned about 1/100 of what I’ve liked, in random order, going back about three years. Powerful yet useless.

      BTW, it’s not that this intentionally expands only the first item. If there are comments in the page, it thinks it doesn’t need to do anything to show them. It there’s more than one post in the page, it would need to do a lot more parsing to isolate and examine each post separately.

      This is really just an opportunistic hack that did what I wanted it to do. It expands all comments and replies for a single post, and that’s the extent of what’s useful to me, and relatively easy.

  3. thanks for you help again but i don’t understand what you mean did you mean it technically impossible to expand all comments in facebook search for all posts or you dont want to do it for a reason ?

    you can write other code and keep this code

    2. what about Continue reading issue

    all the best

    1. I want to emphasize that this is a total hack. It parses the HTML and clicks on things.

      I made a change just now that you might like: it now shows comments/replies for multiple posts in one page (e.g., news feed, search results).

      But this is a can of worms! I ran it on my news feed and it pulled over 650 comments (note: that I don’t care about). I ran it again, and it pulled over 102 more. I had to run it 8 times for it to get everything. This is the kind of thing that I’m just not interested in trying to figure out why. Timeouts probably.

      Re: the Continue Reading issue. I question you really wanting the potentially high number of posts opened in new tabs. It’s not a feature I have the slightest bit of interest in, and I think it could be outright harmful to someone who doesn’t expect it. It’s technically possible.

      Look, I doubt you want to read all the content you want automatically pulled over. I can only guess that you are searching for something. If I were you, I’d try to use the Facebook graph search to find what I was looking for.

  4. i have many friends on facebook some of them write about science and history…. i want to expand all there posts and save the page as pdf to read it like a book

    your code now perfect only Continue Reading issue if you find solution for it it will make it easy to me to read posts

    if you cant open all Continue Reading in new tap( technically) can you make the code bookmark all the Continue Reading posts without open them so i can check them later

    1. I added a little bit to click on the Continue Reading links. But programmatic clicks like that are treated as popups, so assuming your browser blocks popups, you’ll need to add an exception to allow them for Facebook.

      Note: Any posts with Continue Reading links in your “feed” will still have their comments expanded. So you’ll also need to run the bookmarklet in each popup (tab) to get the comments to show up there.

  5. i try your new code on one of my friends profile it only open the first Continue Reading posts in new tap is it possible to open all Continue Reading posts in new tap not only the first posts

    thanks…

    1. It sounds like your browser is blocking popups. With blocking on, the first popup might make it through but subsequent ones won’t (in my experience). Again, you can add an exception just for https://www.facebook.com/. In fact, you can wait for Chrome to display the “blocked popup icon” and set up the exception with a few clicks.

  6. This bookmarklet works great. I only have a need to “View more comments” and don’t need to see replies.

    Since the script executes the comments first if I had a way to manually stop the execution that would work as well.

    thanks

  7. this bookmarklet work well right now but if you code :

    1. find a manual way to stop the bookmarklet during expanding posts some times my internet disconnect but i cant move the page because i can not stop the bookmarklet until it expand all posts

    2. please add other bookmarklet only expand comments without replies

    3. please add other bookmarklet only expand seemore and continue reading in posts without expanding comments and replies

    thanks Jens-Ingo for your help and for your amazing bookmarklet

    all the best …

  8. New feature: if you hit ESC, the expansion will abort.

    But adding options to the bookmarklet? I’ll need to ponder/explore that idea a bit.

  9. hello Jens-Ingo thanks for the new feature i dont know how to thank you your amazing

    i dont know if it possible to you to add option in the bookmarklet to expand posts without comments or other option to expand comments without replies i think you can make new bookmarklet for each option

    i dont know if you have any experience in twitter or not but comments problem not only in Facebook but twitter you tube google+ even Instagram

    one of my friend ask my if it to possible to expand twitter conversation and replies or twitter feed like facebook i said to him i will ask some one who have knowledge in these thing so i dont know if you have any time to make bookmarklet to twiiter or other site like youtube or google + as dennis ask

    youtube have tow problem 1. comments and replies 2. you cant see all your feed unless you click on load more as example : https://www.youtube.com/user/mikawood01

    i will be grateful if you can help on this issues

    best wishes …

  10. This bookmarklet automates clicking on things in the browser. It’s 100% hardcoded to the HTML of Facebook. I created it because I use it every day. Creating something similar for other sites would involve analyzing their HTML and automating the clicking on things. I haven’t done that, and I have no plans to do that.

    There’s no good way to have bookmarklet settings/configuration. I’ve been thinking a bit about this, and what I’m thinking is being able to edit the first few characters of the script before saving it as a bookmarklet, thus allowing you to create multiple bookmarklet buttons that each do something different.

    But here’s an example of a technical hurdle: the Facebook HTML for bringing over more comments vs. more replies is 100% identical (except for the visible text, which I am not parsing to keep this language independent). So, in order to differentiate comments from replies (so expanding replies can be optional), more parsing is required. I’m still looking at that.

    I’m looking at making the script more modular to allow a little configuration of what it does.

  11. thanks for your effort Jens-Ingo i hope you can make the script more modular

    i didn’t know about how hard its to make a bookmarklet like this . my friend is social media

    researcher most of his work on twitter but it hard for him to expand replyies

    ,converstion , feed because of twiiter system as example :

    https://twitter.com/BillGates/status/672063176159068160

    please in your spare time if you find it easy to analyze go for it if not forget about it

    also i want to ask you what course should i study to be able to make bookmarklet like these ?

    is any one study programming can make bookmarklet like yours or it depend on your creativity ?

    all the best

    1. Writing bookmarklets requires knowledge of HTML/CSS and JavaScript/DOM. Though you probably won’t find a class on bookmarklets, any knowledge you gain in HTML/CSS/JavaScript/DOM will apply.

  12. New feature: you can now customize what the/each bookmarklet does (any combination of expanding posts, expanding comments, and expanding replies). See the blog section titled “Customizing the Bookmarklet”.

  13. Thanks a lot for making this bookmarklet , it saves me more time, you made my day it help me a lot i got tried of click on “view previous comments in Fb” can you able to code work as well for linkedin (see more) comments ??? else can you give some more tips to make it possible .. thanks in advance i’m looking forward to it …

  14. The only comment-based social medium I use daily and feel like I understand is Facebook. Though I’ve used all the other social media mentioned, I’ve never used them enough to feel like I did daily on Facebook (before I wrote my bookmarklet), which was, “here I go again clicking 50 times to read 30 comments.”

    I can only give tips that assume familiarity with browser development with JavaScript/DOM/HTML/CSS. Hit F12 for the DOM browser. If you’re doing the same thing over and over again, familiarize yourself with the DOM structure of what you’re interacting with. How would you automate what you are doing, such that you could just let the computer do it for you? You can only automate what is 100% systematic. If it can be expressed simply in words, it can probably be automated.

    I guarantee that every social medium will have its own unexpected quirks, timing issues, and so on. There won’t be one thing that magically works with everything.

  15. I am just an end user.I was looking for this feature and I am glad that you had given me the solution.Thank you.I have recommended it to my friends. Please do track the changes in facebook and keep the bookmarklet working just for the sake of end users like me.

  16. Hi, Thank you very much for taking the time to code the script. It is amazing! a few posts earlier a fellow commenter requested making it possible for it to run on all posts in the news feed. this is not something that no one would want for it would be a priceless feature if used to view all posts in a group.

    1. As mentioned (circuitously) in a previous comment and now the main article, this works now. I’ve tried it on my main feed, an invisible group, and various search results. In general, I remain skeptical that this feature is really safe-and-sane. I mean, I have friends who love to respond to those senseless threads that get 200,000 replies and go something like “2 + 2 = 5. Respond if you disagree.” If you start a massive expansion and want to cancel, just hit ESC.

      To clarify one thing: this only expands posts that you have manually scrolled into existence, so to speak. Feeds in Facebook are essentially infinite, and automating pulling over all content since the beginning of Facebook time just doesn’t make sense to me.

    1. I don’t understand. You’re saying it doesn’t work, or asking it not to do it? In my testing, it works. If you see something not working and supply a URL to a public post with the problem, I can look at it.

        1. Thanks for the URL! Yes, I see that full expansion is not occurring, but even if I just manually click on the link, nothing happens. I don’t understand why Facebook just stops delivering comments sometimes. My script only automates clicking on links, just as if a person were doing it.

          1. In my browser, I can click on “View previous replies” twice. But I found easy workaround — just click the bookmarklet once again, and it unfolds all remaining replies!

            Great work, and it works fine even in restricted environment, unlike chrome extensions 🙂

  17. You are my hero! Thank you! 😀

    I use a screen reader to listen to 12-24 comment threads per day and I was getting extremely tired of manually expanding all replies and clicking on all “See More” links within each thread.

    You just saved me like 10-20 minutes of tedious, annoying work per day. Thank you.

  18. OMG…thank you so much. I have become fairly addicted to Facebook since retiring and belong to many, many groups. My greatest frustration is being immersed in some heated discussions only for the “show more replies” to stop opening those replies. This works beautifully!

  19. Brilliant bookmarklet, thanks. I’ve recently had a problem of missing replies through not getting notifications from Facebook, so your bookmarklet has made it so much easier for me to quickly look through the posts to see if I’ve missed anything. Cheers!

  20. Many thanks for this awesome bookmarklet!

    It works fine with Facebook posts comments. But in the future, would you modify this script that it decens also Facebook Comment Plugin comments and normal posts like list?

    For Comments Plugin, I mean e.g. https://goo.gl/Biiwj2 (no scrollbar, use arrow keys)

    For like lists, I mean e.g. https://goo.gl/3xnbas

  21. “Then, run the bookmarklet on the isolated post.”

    Maybe I’m dense, but I can’t figure out how to do this. How do I run the bookmarklet? I can’t get it near the page with the links. I isolate FB posts all the time, so I know how to do that, but once isolated, I have the “expand all” link in one tab and the post in another. The bookmark bar is there with the post dragged to it. What next? All I can do is switch between tabs. How o I run the “expand all” link” on the other tab?
    Thanks for your time.

  22. THANK YOU, THANK YOU, THANK YOU!
    This is exactly what I need. Am involved in a long, long research thread and did all the expansions by hand TWICE as they kept collapsing. I need to have all the material that others have supplied. So now I’m a happy camper thanks to you. Had taken me something like 3 hours but now in less than 3 minutes it was all finished! Then I copied the entire thread into a LiberOffice doc and it’s 73 pages! The job is done, thanks to you. BTW, using FF.

    1. I like this idea. I’ve added this as default behavior, but it can be turned off via the customization procedure described above.

    1. A bookmarklet operates in the world of the existing web page: HTML, DOM, CSS, JavaScript. That Python script uses Twitter APIs and prints its results to a console. There’s really no relation.

  23. thank you do you have any idea how can i get all the tweets from any user ?

    there is some script but only get the last 3200 tweets

  24. Wonderful bookmarklet! I am currently using it to archive my fb feed, and your bookmarklet has come in so handy! The only tool of its kind on the internet! Great work, keep on optimising it for speed and performance… A big thanks again for making our lives easier!

  25. So recently, facebook just idiotically implemented this new feature that scrolls into a certain post in a timeline even if we were to follow the permalink to said post. In other words, permalink doesn’t show single post, but rather just show you where it is in a page’s timeline. Consequentially, using your bookmarklet will expand ALL POST ON THAT TIMELINE. And currently, there is no way to turn off this feature.

    Never change facebookdev.

    1. The problem I see is with those public pages that anybody can view or subscribe to. The permalink URL puts the post of interest at the top, and the page continues with the rest of the feed below; there’s no way to isolate the post.

      I think I’ve addressed this now. If the post of interest is found at the top, this bookmarklet only expands that post (and logs a message accordingly). Otherwise, it expands everything it comes across.

      1. Your fix with page post is great, but it’s still imperfect since I found another problem. Like you’ve said, permalink on pages will not isolate the post but rather showing said post on top of the said page’s timeline. But again, if said page has a post pinned, then permalinked post will be shown second.

  26. My girlfriend and I use private Facebook notes to communicate, so they generally accrue thousands of comments from our back-and-forth. I want to save these, because I’ll be killing my FB account.

    One note had 21K comments and SEVEN thousand “See More” links.

    Facebook’s “download your account” does not dump notes, so I did a bunch of searching, looked into imacros/greasemonkey/etc. Finally found bookmarklets and one that worked marginally ok, and then this post.

    TL;DR: THANK YOU.

    1. Keep in mind that the bookmarket can time out. (Also, I have found that Facebook simply stops delivering comments after a lot.) You can run the bookmarklet multiple times without penalty to check for content that didn’t get expanded for whatever reason. (Well, I will admit I’ve never tested beyond a few hundred comments.)

  27. I am SO glad that someone not only thought of this but also has done it! Thank you so very much for this script, brilliant work! … I want to mention a couple of things here that I do in order to see someone’s whole Facebook page and save a COMPLETE copy … 1. I go to the Facebook page I want; 2. I allow popups from Facebook (on Firefox) so that this bookmarklet works 3. I use Flashblock Firefox add-on in order to block videos on the page from all auto-loading at the same time 4. I close any other tabs or any other thing running, as this can get pretty resource-intensive! 5. I then press down the PgDn(Page Down) key on the keyboard, then stick a penny into the keyboard on the bottom of the PgDn key between the key and the keyboard housing (only works with traditional PC desktop type keyboards, there may be another way with other devices) to hold down the PgDn key … that will keep the page scrolling on down until you have reached the bottom. … THEN DON’T FORGET TO REMOVE THE PENNY! 6. Click the “Expand All” bookmarklet in your bookmark toolbar. 7. Watch and wait as this amazing bookmarklet expands everything!

  28. Hey, this is great, however do you have one that works with the mobile version of facebook (m.facebook.com) ?

    The reason I am asking this is because sometimes I like to archive a thread and I usually archive the mobile version on my desktop.

    Btw, Thank you for your great bookmarklet!

    1. There’s no mobile version. I never even thought of loading the mobile version on a desktop. Interesting.

  29. Awesome work, I was futzing around with macros trying to achieve the same end, with little success. Please keep at it if the code changes, I’m sure I’m not alone in being willing to support your work. I absolutely despise the whole click to expand comments bit from any website and am always trying to find ways around them. Slashdot was always great for that, 500 comments loaded at a time, you’d have everything up in short order. Reddit is terrible. I found a Tampermonkey script to work with Discus but it broke. I bet someone’s done something similar to yours for YouTube.

    1. Maybe I will look into using SourceForge one of these days.

      From a design standpoint, my theory has always been: optimize to work with a few hundred items, but acknowledge there is a threshold where paging/clicking-on-demand of some sort is needed, but it should be unlikely you would ever use it. If you are using it, then the UI is broken.

      If you force the user to click-on-demand to see 2, 10, or even 100 items, then the UI is broken. “See More” all over the place just adds insult to injury.

      What if there are 100,000 items? Okay, chances are you don’t want to see them all, but the UI should make it clear that they exist. At that point, what you need is a good search interface, which Facebook does not have; the language is there, but it just doesn’t work. Once again, the emperor has no clothes.

    1. No. All I can do is corroborate that I’ve seen Facebook stop delivering comments after a certain point, where that point is different for different posts.

  30. Brilliant. I needed this so I can save and print to PDF a thread on fb I started in case the company I complained to takes it down. I especially appreciate your concern for people like me who suspect anything I download from the net. You give a complete explanation of what it does and how to check that. BTW F12 doesn’t work on Chrome 49 but ‘alt-cmd-j’ does. Also no beautifier simplifies the code. 🙁

  31. Great script, I have multiple pages with thousands of comments, and this saves me alot of time if I need to do a print screen on all of them.

    Is it possible to also show the hidden comments, the ones with 3 grey dots? Not show like make them visible for everybody, but so that is possible to get them in the print screen.

    Thanks again.

    1. I’ve never seen a hidden comment and don’t know how they work. I have found a page that talks about them, yet I am unable to create any to see how they work (perhaps because Facebook considers me a safe commenter on my own posts).

      All this bookmarklet does is automate the clicking that you could be doing. It can’t do anything you can’t do yourself, since it’s just acting as you. If you still think there’s something that can be automated, can you provide a link to a public post containing a hidden comment, so I can see it?

  32. Thanks for the great code!

    However, I’m facing a problem with facebook page.
    I use the Google Chrome AutoScroll extension to scroll to the end of the page, then I run the bookmarklet (Chrome Version 53.0.2785.143 (64-bit) on Linux Mint 18). It starts very well and detects about 850 items. It works till it reaches around 200, then suddenly I find it opened a link to one of the notes of the page and browsed to it, so it destroys everything.

    Do you have any idea why that might be happening?

    Thanks again.

    1. Can you provide a link to a public post with this problem? I looked up how to work with Facebook Notes, and created one, but it does not cause a problem. (Notes should be ignored by this bookmarklet.)

      Since this bookmarklet clicks on Facebook links, if there’s a Facebook link that navigates away from Facebook, yes, in theory that could cause a problem. But it would help if I could see an example of that.

  33. Hi Jens

    Thanks for this. I wonder if you would consider keying this on the mobile (m.facebook.com) or even (mbasic.facebook.com) I use these to be able to then print out a sane view of the post and comments. (mainly m.facebook.com)

    Either way thanks for what you’ve done here

  34. Really great! I’m using in this moment your script to try to find a comment on a famous actor’s page.
    Now i’m at 7500 comment of 19,619, script still working, sometime using ctrl+f to search the name of commenter.

    I think can be useful add an option to look for a string than pausing/stopping the scritpt when found – Maybe I can try to change the script by myself but I’m not really a good programmer 🙂

    Chrome task manager tells me I’m using more than 1,2 GB of ram for that page but a little data from Internet, taking 40% of CPU. Page is now really slow but the script is still working
    Chrome, windows 10, core i5, 8GBRAM

    Ops! While writing the text above the page crashed, out of ram! Thats all 🙂

    1. Thank you for pointing this out and for including the URL. I believe I have fixed the problem (and a few others). The problems are caused by Facebook changing, not the browser. You can update the bookmarklet at the link found at the start of this article.

Leave a Reply

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