Update for 2023+
This no longer works. This tool stopped working sometime early in 2023, and I will no longer be maintaining it. It kinda-sorta still works (better on old / legacy threads), and I’ll leave it up indefinitely. It has stopped working due to Facebook changes that, as a human, make no sense to me and have finally caused me to ignore Facebook (going on six months now).
Old introduction
I have written a JavaScript bookmarklet that expands all comments and replies in Facebook posts. This applies only to the full version of the Facebook website (e.g., www.facebook.com) and not to other web versions (e.g., m.facebook.com, touch.facebook.com) or 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 Scroll All bookmarklet.
2021-02-17: I put this in GitHub.
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. This is how I use it, and I use it only on individual posts with usually many fewer than 100 comments and replies.
Others use this to expand multiple posts prior to archiving them. That wasn’t my original usage model and can hit Facebook limitations on how much it will retrieve (plus, it gets slower the longer it runs), but it’s still better than manually clicking.
To isolate a single post to a browser tab, ctrl-click on the post’s time stamp link, which is a permalink URL.
Warnings
If you need to 100% guarantee this bookmarklet does not click on something it shouldn’t, your only option is to avoid it altogether.
This is a bookmarklet and can only do what you can do, as you. There’s always the risk of clicking on something that wasn’t intended, especially if the code I write now decides to click on something that becomes something else in the future. This is what happened in 2020 with the translation links: they became indistinguishable from the like links (and the untranslate links, and the remove preview links). It became easier to remove the translation feature from the bookmarklet than claim to be able to figure out to not click the like link.
I would characterize the latest changes as follows: in some cases, where it used to be possible to select a list of links that should be clicked, now that list needs to be filtered by what should not be clicked. Unfortunately, that list of what not to click is probably incomplete. I found many cases to avoid, but others might find other cases.
This bookmarklet will not traipse down a multistep procedure, such as submitting a comment or sharing something. Check your Facebook activity log—you can likely undo any action taken. I myself would probably commit harakiri if I found out I had acted on a Trump post I was lurking on and could not undo it.
2021-01-20 notes
When I originally wrote this bookmarklet in 2014, I could hardly believe it kept working with no changes. I sat on it for about one year with no changes to Facebook before publishing it. Now in early 2021, Facebook changes every day in such a way that breaks this bookmarklet. The daily UI changes are gratuitous and serve no visual purpose.
The daily Facebook change involves an image ribbon and the CSS used to display an image from the ribbon. It all changes under the covers daily, yet there’s no visual change. I thought I’d be able to fix the problem by programmatically analyzing the CSS on-the-fly but no, both the CSS rule name and the CSS rule itself change (every day), for no actual purpose. There doesn’t seem to be a way to programmatically determine the CSS rule name from anything fixed. Plus, parsing CSS across browsers seems to have insurmountable security restrictions.
Up to this point, I managed to keep this completely independent of the display language, meaning you could choose any of the 112 languages supported by Facebook and this tool would work. I did this by keying only off the CSS and DOM structure.
This has changed now that Facebook changes CSS names and definitions daily. I’ve resorted—in only one case—to parsing display text. Of the possible 112 languages, I’ve added support for 34 or so. Maybe eventually I’ll link to a list of supported languages so it’s clearer. Part of the problem is that now, if Facebook changes the translation of the text I’m using, including fixing problems, it will break the bookmarklet.
The failure when a language is not supported is not terrible; under certain conditions, the bookmarklet won’t click a link that retrieves more replies. I think I’ve eliminated the problem with expand / collapse loops (using code), and only some threads won’t be fully expanded.
It only takes 5 – 10 minutes to add support for a language (not long). Facebook supports 112 languages (supporting them all would take days). I’m happy adding individual languages, but I plan to do that only if I hear of them (i.e., upon request).
2020-11-30 update
I made a difficult decision today to make a change based on Facebook’s incessant changing and breaking this tool (collapse/expand looping). The change is intended to prevent loops, but it is at the cost of an occasional (rare, I hope) incomplete expansion.
There will be just as much maintenance, except it will be to click on something that should be clicked on rather than to avoid clicking on something that shouldn’t be clicked on. When it breaks every few days, it will cause some (hopefully) rare expansions to be incomplete rather than to get stuck in infinite loops.
I’m also hoping to address the problem of leapfrogging, where certain locales are greater-than-one Facebook builds ahead of me, so they never benefit from the changes I make, as I’m always a few builds back.
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 responses being displayed. New log text goes to the top rather than the bottom.
The bookmarklet clicks on links to get more responses. It clicks and waits for the new content, which is recursively checked for new links. After all the responses are obtained, it clicks any and all See More links.
It finds links to click by querying on CSS style names and is thus cultural language independent and should work with Facebook set to display in any language, with the exception of:
Before expansion begins, comment filtering is checked and, if needed, changed to All comments. This is starting as an English-only feature; additional languages added upon request. Messing with comment filtering is optional (see bookmarklet settings).
Please don’t do this
This isn’t recommended on posts that have many thousands of throw-away comments:
- You probably aren’t really interested in that many throw-away comments.
- It gets slower and slower as more comments are pulled over, which I think is more of a browser thing than a Facebook thing.
If you want to stop the bookmarklet, hit ESC if ESC doesn’t conflict with what you are doing, or click the bookmarklet again. If you run it again, it will pick up where it left off (effectively, not literally).
Bookmarklet settings (new)
This section is new as of 2019-03-14.
Please be aware that modifying settings for this bookmarklet is weird and backwards, but bookmarklets are themselves a little weird. To modify the settings, you must run the bookmarklet from Facebook; the settings UI comes up at the end by pressing ‘s’ sometime during its run; changes you make are for next time, not this time, if that makes sense.
You can customize the bookmarklet from any Facebook page, but if you want to ensure that it finds nothing to expand, you can run it on a Facebook page with no posts, such as https://www.facebook.com/find-friends/browser/.
The UI settings will not persist across browser sessions if you are incognito/private or running Tor’s Firefox browser (see next section).
If you use this UI, you can no longer have multiple Expand All bookmarklets with different settings (see next section).
Customizing the bookmarklet (old)
This section is old as of 2019-03-14. I’m leaving it here in case their are fanatics who either use Facebook incognito/privately or use Tor’s Firefox browser.
You can customize what the bookmarklet does. You can install multiple bookmarklets, each with a different customization.
When you edit the bookmark (Properties in Firefox), you will see near the very beginning todo=6. You can change the numerical value. With this value, you control four bits of instruction:
- 1: not used anymore
- 2: expand comments
- 4: expand replies
- 8: not used anymore
- 16: do not ensure comment filter (if it exists) is set to All comments
In combination, there are 8 possible values. Some examples, starting with a value of 6:
- Subtract 4 to not expand replies
- Add 16 to not change any comment filters
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 (everything I tried did not work).
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.
- The script doesn’t parse display text.
- You can run the bookmarklet multiple times. 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.
Troubleshooting
Make sure you are using the latest bookmarklet. Let me know what language you use Facebook in and which browser family you use.
If this bookmarklet used to work and stopped working, chances are Facebook has changed, and I need to change the bookmarklet. I might notice the breakage myself, but it probably won’t hurt to let me know about it. Changes I’ve made are listed here.
As we learned in 2018, Facebook changes can roll out over a period of a few months. I’m in Silicon Valley (Santa Clara, California, U.S.A.), and my guess is that I can be the last to see changes (and thus, problems), as Facebook seems to use less-trafficked areas as beta sites.
If you’ve never seen it work in a situation:
⇨ If it doesn’t work for a public Facebook post that you can reveal without a violation of your privacy, send me or post a comment here with the permalink URL in it, and I will look at it.
If it works except for some non-public posts, chances are I won’t have be able to observe what makes it special and therefore won’t be able to fix it. I might be able to reproduce a problem in my own private context, depending on having the problem adequately described.
- Bear in mind that this just automates clicking that you would otherwise do. Manually click on what is not working, and assess the situation from there.
- You can run this bookmark multiple times without penalty. Sometimes doing so can reveal a clue, especially interspersed with your own clicking.
- I consider myself a regular Facebook user. If there’s something unusual or nonstandard about your situation, feel free to elaborate. For example, I have no idea how to create, see, or show a “hidden comment.”
- Facebook has limitations. Please read the section titled “Please don’t do this.”
- It often doesn’t matter how brilliant you are at capturing the problem (e.g., with screenshots). If I can’t reproduce the problem, I probably can’t fix it or test any fix now and in the future.
Leave a Reply to Jener Gomes Cancel reply