Like Everything on Facebook with this JavaScript Bookmarklet
March 15th, 2011 | 12,256 views | 44 Comments » | TweetDo you want to like every post and comment that you see on Facebook all at once? Well, it’s your lucky day.
Drag the link below to your Bookmarks Bar and click it to automatically like all the posts and comments on the page you’re on.
I Like Everything
(drag me to your bookmarks bar, go to Facebook, then click me!)
Why’d I do this? Some friends and I were playing around with Facebook’s new comment-on-enter feature and we got a large 70+ comment thread going, then people began to like every comment in the thread, so the idea for this JavaScript bookmarklet was born. I whipped it up in 15 minutes.

Source Code:
If you are curious how this works, here is theĀ abbreviatedĀ source code:
var sad = document.getElementsByTagName('button');
var happy = [];
// Select only the Like buttons.
// Convert the sad NodeList to a happy Array.
for (var i = 0; i < sad.length; i++) {
if (sad[i] && (sad[i].title == 'Like this comment' || sad[i].title == 'Like this item')) {
happy.push(sad[i]);
}
}
function happyFn(happy) {
if (happy.length <= 0) {
return;
}
happy[0].click();
// Wait for each Like to be processed before trying the next.
// Facebook enforces this requirement.
window.setTimeout(function() {
happyFn(happy.splice(1));
}, 800);
}
happyFn(happy);
Get the full source code on GitHub.
Bookmarklet Source:
And here is the source of the bookmarklet, perfect for copy-pasting into a convenient bookmark. Or just, drag this link to your bookmarks bar.
javascript:var s = document.getElementById('happyScript');
if (s) {
s.parentNode.removeChild(s);
}
s = document.createElement('script');
s.setAttribute('src', 'http://www.feross.org/hacks/like_everything/like_everything.js');
s.setAttribute('type', 'text/javascript');
s.setAttribute('id', 'happyScript');
document.body.appendChild(s);
void(0); // don't redirect
Update:
I just updated the bookmarklet to show some UI about the progress of your “like bomb”, as well as a button to stop the liking if you suddenly have a change of heart. Everyone’s bookmarklets should be updated automatically. Go here if you want the updated source code.
Update 2:
I just fixed a bug in Firefox where clicking the bookmarklet causes the browser to redirect to a page with the message [object HTMLScriptElement] shown. You should update your bookmarklet. It turns out that you need to end all JavaScript code within links and bookmarklets with void(0); or else the browser will try to follow the link.

Is the 1.5s timeout necessary? It takes a long time to like all those comments
David, the delay is necessary since Facebook only allows one Like button to be clicked on at a time. While one Like is being processed all the other Like buttons are disabled.
I changed the delay to 1000ms and it feels much better.
Added a line to make it flash red when clicked as well. Watch it cascade down the screen!
javascript:var%20sad=document.getElementsByTagName(‘button’);var%20happy=[];for(var%20i=0;i<sad.length;i++){if(sad[i]&&sad[i].title=='Like%20this%20comment'||sad[i].title=='Like%20this%20item'){happy.push(sad[i]);}}%20function%20happyFn(happy){if(happy.length<=0){return;}%20happy[0].click();happy[0].style.color='#FF0000';window.setTimeout(function(){happyFn(happy.splice(1));},1000);}%20happyFn(happy);
Thanks Matt! I used your red style idea in the updated version of the script I just posted.
When I’m using the bottom bookmarklet, it only likes one post, starting with the top, instead of liking multiple posts on a page.
You’re a legend Feross
Thanks!
I recently changed the bookmarklet, Andrew. Delete your old one and try it again.
Iconic88, thanks! Glad you like it!
Very smooth js. Not sure I would ever use it though because I rarely like everything that everyone has to say and would want to give some goober the wrong idea.
You do rock!
I love your previous work. Can’t seem to get this to work for me. It redirects to a javascript URL with ‘[object HTMLScriptElement]‘ shown. I may have done something on my end as I know nothing of javascript.
how do you do this?
Hey Feross that’s nice…
here my improvement:
http://giuseppegurgone.com/like_everything.js
that version should work with any languages
Does this like the ads as well?
Good tips!
hey man facebook is cracking down on liking too fast. is there one that is time delayed?
@Alan – What do you mean Facebook is cracking down? What behavior are you seeing?
@Dan – No, this does not like the Facebook ads.
@Giuseppe – Nice improvement! Language independence is a good idea.
@Ron – Sorry that you’re having trouble getting it to work. Did you drag the link to your bookmarks bar? If it still doesn’t work, tell me what browser and browser version you’re using and I’ll look into it.
People don’t get notifications anymore when you like their posts
Not true. I just tested it. Maybe you’ve been doing too much Liking?
@Feross
Yes I have tried that. I am using Firefox 4 on Arch Linux. I can suck it up and just use it in Chrome, because it works there. But just a heads up.
@Ron Ah, that is certainly an obscure setup. I don’t know anyone who uses Arch Linux. It looks like the problem is only with Firefox. Not sure what’s causing it, but I’ll look into it.
@Ron – I just fixed the bug in Firefox. You need to update your bookmarklet. It turns out that you need to end all JavaScript code within links and bookmarklets with void(0); or else the browser will try to follow the link. It should work now.
I’m talking about using a Facebook as a page that’s yours. It works with a regular account, but not if you are using a Facebook fan page to run it.
Pros to you.It does work now, Thanks!
hello. Block! You are engaging in behaviour that may be considered annoying or abusive by other users.
You have been blocked from using the like feature because you repeatedly misused this feature. This block will last anywhere from a few hours to a few days. When you are allowed to reuse this feature, please proceed with caution. Further misuse may result in your account being permanently disabled. For further information, please visit our FAQ!
so how to hide this spam?
Sorry to see that you were blocked. Just wait a bit and you’ll be able to Like again. Next time, don’t go so wild with the Liking.
How to remove this source code, after once it has been added ??
hey dude you should make a java script that likes all check boxes
Hey,
I used this and it was great, it liked every post i wanted it to BUT… it doesn’t appear in peoples newsfeed that i have liked there comment, and thats what i need so they come to my page and see who i am etc.
Any solutions to this?
Can anyone help with the post above?
Yeh, same problem over here.. it likes the stuff perfectly.. but people don’t get notifications that their post has been commented on.. please fix, it’s an awesome bit of code!!
you should make a java code to like all comments on a youtube video
I used a like script for exactly one click, which liked about 20 updates and I got the blocked message from facebook. How INSANE!!!!!!!!!!!!!!
I’m using facebook for business and paying for advertising. I thought a script might help me speed up liking all my new fans posts.
Dude, tried the stuff, and got blocked by facebook for a few hours! Need to find a way to do it slow..
Why does it not appear on the persons newsfeed that you have liked there comment?
Is there a way of making this happen?
FEROSS PLEASE REPLY!!!
I just got blocked, tried to like about 800 items and that’s all.
By the way, Feross you’re a big inspration for me, thanks a lot.
Keep it great man!
Does the timeout need to be changed? I got blocked at 60 likes.
Using part and some ideas from this script, I’ve made this:
http://fferegrino.blogspot.com/2011/10/retweet-all-on-twitter.html
That’s pretty cool. Good job!
Feross I just listed your I like everything Bookmarklet in http://teckzone.in/blog/2012/02/some-really-amazing-bookmarklets-for-an-awesome-browsing-experience-and-boost-up-your-speed-and-productivity/
Excellent piece that is… I would also love a bookmarklet that shows me the most liked posts on a page. I mean, i should be able to see all the very important posts (most liked, shared and commented) in a page at the click of the bookmarklet. Do you have anything of that kind