2 Simple Methods To Add All Your Friends To A Facebook Fan Page Or Group
EDIT: Please read the comments before reading this entire post. This is no longer supported and I will not be held responsible for what you do with it. I’m not even sure any of this still works.
Recently, John Chow made a post (found here) showing us all how to use a little JavaScript trickery to do what normally would be a rather tedious task on Facebook, inviting ALL of your friends to a group or fan page. If you read through the comments made on his post, you’ll notice quite a few people saying the method is dead. I beg to differ!
To resurrect this method and to help John Chow and his hearty following, I’ve come up with 2 simple alternatives to help you continue to easily do this task without resorting back to clicking on each and every one of your friends. The first method uses the same code John posted, but very slightly altered to ensure that it works every time. Here’s how to implement it, if you’re a FireFox user, without having to paste the code into the URL bar every time:
Step 1: Enable your Bookmarks Toolbar (if it isn’t already)
1a: Right-click the menu bar and make sure there is a check next to “Bookmarks Toolbar”

Step 2: Add a new bookmark to the toolbar
2a: Right-click the Bookmarks Toolbar and select “New Bookmark…”

Step 3: Edit the bookmark properties
3a: Type a short name for your bookmark (shorter is better!)
3b: Paste the following JavaScript snippet into the “Location” setting
3c: Click the “Add” button (you should have noticed your newly made button by now)
javascript:elms=document.getElementById('all_friends').getElementsByTagName('li');for(var fid in elms){if(typeof elms[fid] === 'object'){fs.click(elms[fid]);}}

That’s all there is to it! You can go test it out now. If you find that this method still no longer works for you, then Facebook is up to its silly little games again. They seem to roll-out changes to people at different times. For me, this method is still alive and well. If you can’t use this method, here’s another simple alternative for you FireFox users:
Step 1: Install the Greasemonkey extension (found here)
Step 2: Install this Greasemonkey script (found here)
Yup, simple as clicking the install buttons found on each of those sites. If you’ve followed all the steps correctly, you should now have 2 working methods to select all your friends on Facebook. Happy inviting!

As you may have noticed, I’ve only explained how to use these methods using FireFox instead of Internet Explorer, Opera, Safari, or Google Chrome. While they may work in alternative browsers, I haven’t tested. The only browser I use is FireFox. Please feel free to tryout the other browsers and let me know how it goes for you. The bookmark method should be cross-compatible with all browsers that support JavaScript. As far as the Greasemonkey method goes, there may or may not be Greasemonkey plugins/extensions for other browsers. If there is, I can’t guarantee my script will work on them. Anyways, if you try other browsers, let me know how it goes.
If either of these methods helped you, or if you seem to be having some sort of issue with them, please post in the comments below to let me know. Thanks for reading!
EDIT: As of 8/25/2010 Facebook has changed their coding…
EDIT: I have fixed the coding to work again!!!
EDIT: Sorry guys! The JavaScript broke again. ONLY the Greasemonkey script works now. You can install the Greasemonkey script as a Google Chrome extension if you don’t use FireFox…
I had a video demo of this script in action, but Facebook deleted my account and I no longer have the video. For whatever reason any new account I make, at least the ones with my identity, get deleted. Facebook officially hates me and I no longer partake in any Facebook activities, for the time being. Thanks for all your support, it was fun while it lasted.
Comments
There are 32 comments for this post.
Trackbacks
There are no trackbacks on this entry.





Is it possible to incorporate this code which you developed:
http://userscripts.org/scripts/review/70384
into a button on my facebook page so that someone could invite all their friends to my page with one click?
thanks
Unfortunately, with the way Facebook manipulates JavaScript functions in their FMBL, I don’t believe there is any way to have this function as desired on your page. This is merely a script that will work for Greasemonkey on FireFox web browsers. You can, however, instruct your members to use the first method explained above. Instead of having them make a bookmark button, have them simply paste the code into their URL bar once the list of friends has loaded.
For a group, you could say something like this:
▪1.) JOIN THIS GROUP!
▪2.) CLICK ON “Invite People To Join”
▪3.) SELECT ALL YOUR FRIENDS
→ To quickly invite all your friends:
Copy the code given below
click on “Invite people to Join”
delete all from your address bar
paste the code in and press ENTER!!
javascript:elms=document.getElementById('all_friends').getElementsByTagName('li');for(var fid in elms){if(typeof elms[fid] === 'object'){fs.click(elms[fid]);}}▪4) CLICK ON “Send Invitations”
Hope this helps a little…
This has stopped working on facebook due to the recent changes to the Events platform. It does not work as either option (greasemonkey or a bookmarklett)
First, thanks for leaving a comment. I’m aware of this issue. I’m working on getting a fix for this. Check back soon!
I have fixed the javascript above to work again! ENJOY!
@ Makis Arvo
Wich are the NEW JavaScript Code to put in the browser’s search bar on top?
best regards
If the one pasted above no longer works in FireFox or Google Chrome, the only alternative at the moment is to use my Greasemonkey script. For best performance, install it as a Google Chrome extension.
Facebook keeps making changes to their code which blocks the browser bar codes from working properly. My Greasemonkey script will continue to be updated as needed.
thanks for the Information.
Thats bad, because I can not say to my friends that they should download the Greasemonkey script, thats too complicatet for those.
If by friends you mean fans on your pages, posting such code would only leave a footprint for Facebook to quickly delete your page. If you are simply just trying to get your buddies to do you a favor, then unfortunately the only option at the moment would be to get them to use Google Chrome to install the Greasemonkey script as an extension as it doesn’t require Greasemonkey to be installed. That could eliminate half of the headache of explaining how to install Greasemonkey.
The problem with the new Facebook changes breaking the JavaScript is that the invite box is created inside an iframe with AJAX, so to the browser, it doesn’t exactly exist. Firefox, IE, Opera, and Chrome all handle JavaScript slightly differently so getting a script to function on all browsers is going to be a bit of a trick. I’m sure someone will figure out a new way, but for the time being, my Greasemonkey/Chrome extension works just fine and is easier to maintain as it is much more versatile.
If I ever figure out the new way of just pasting the JavaScript, I will post it here but it would only be a matter of time before Facebook changes something else to stop it. As I said, the Greasemonkey script is much easier to update when said changes occur, so that is my primary focus as it’s more of a “product” that I have to support.
thanks for the information.
How work the greasemoneky addon?
Because i tryed it but seem doesn’t work very very well…
if i insert:
to 0 from 50 it doesn’t select me 50 friends
Admittedly, I never did full testing on FireFox but as a Chrome extension, it is working rather well for me and many others. I guess I need to do some bug testing on FireFox… Sorry man.
Hey arvo,
For some reason the script is not picking up the amount of friends I have and wont work.
Any ideas?
I tried Chrome instead of Firefox BUT it just takes forever and keeps saying “kill or wait” and I wait over and over and over… BUT NEVER DOES ITS JOB!
I wish I knew what to tell you man. Here’s a video demo I just did using Chrome: http://www.facebook.com/video/video.php?v=105548689506217 (hope you can view it). What version of Chrome did you try?
I been messing around with this, I found that the select all JS code still works if you isolate the frame.(easy to do with chrome or firefox,right click, “Open frame in New tab”)
What im wondering is if its possible to create a script to remove the frame first then selct friends?
Yes, that method still works. The frame is the reason it all broke in the first place. As far as creating that script, I’m sure it could be done as a Greasemonkey script. As a browser bar script that you can simply paste, I’m not sure if that’s a possibility…
I know for the app Mafia Wars they have un-framing script that works from bookmarklet
http://www.spockholm.com/mafia/unframe-beta.js
Not sure if its same concept?
Makis,
Thanks for all your hard work. Much appreciated
Hi, does your code bypass the recent 49 friends invite to a fan page?
No, it currently does not bypass that problem. When I have time, I will update the code to correct this issue.
I was able to install it correctly and I used it to select all of my friends to suggest a page. But none of my friends have received the page suggestion yet, and when I go and try and select friends manually for that same page I cannot, because Facebook thinks I have already sent them a Page suggestion request.
Has anyone else had this problem?
Unfortunately Facebook seems to have put a limit on the invites. You can only select 49 at a time. I haven’t had the time to post a fix to the code as I don’t really use Facebook much at all.
i installed the greasemonkey script in chrome (just installed chrome for that). i have 2 fb accounts. one with 80 friends and one with 5000. the script only work in the account with 80 friends. can somebody tell me why? i tried deinstall and be logged in in the other account etc etc nothing works. i dont get it…
some help would be great!! freaking facebook
In order to use the previous javascript code, a user wishing to select all friends from a list must first re-launch the embedded iframe into a new tab within the web browser, now the _parent document is selected all behaviors with have a top priority affect on content within that document; in this case it is just the friends list so it wont take long till you know all is well. If you have over a thousand friends expect a wait of up to 10 minutes, 5000 friends usually takes 3/4 of an hour, you can get in contact with me on http://www.revolut.tv/ if you have any quires.
Hey Just Read up this and all the comments.
Well a while ago it used to work, Until facebook has the new groups…it still works absolutely wonderfully with facebook pages and events..
but the new groups suck! you have to type out each name! or type in one letter and let facebook give you a suggestion!
If ANYONE has a way to add all your friends to the NEW GROUP leave a reply please as i will check back soon..
this has again stoped working due to facebook updating itself, please help with new code
The brand new facebook will not allow the greasemonkey extension…can you make an updated one or give a link to it?
Hey Arvo,
Its Kevin from Facebook Formulas. Are you working on a new script for this or should we look elsewhere?
Thanks for everything,
Kevin
Sorry man, no plans for a new script at this time. Perhaps in the future, but I don’t mess with facebook right now…
no point worrying about this code anymore, facebook has been ruined; they have deleted the accessibility to invite all friends to like pages, the group pages are now joke, friends who make new groups can add additional members without notification, or reason, users added are not notified on groups they did not agree to. faceboook is not what it used to be clearly, since the whole world is on facebook pretty much, server bandwidth and traffic overload have become a serious issue, admittedly facebook have done what they can to minimize the flow of traffic on their site, which means cutting of the features we all used to love.
Businesses use facebook as a way of selling their selves, large credible multi corporate websites use their initiative by signing up to facebook and inviting friends to join groups, or ‘like pages’ if you will. numbers on the likes or pages usually determine the companies credibility, since facebook has removed this feature, users are forced to market their product or services through an intensive regime of facebook marketing, the results are skeptical needless to say and varied from reliable to useless. I have quit now realizing the endless problems.
Additional problems related to computer viruses and tracking cookies all come from facebook. these web designers know what there doing they have created a specialised language format that literally enables them to make up anything they want, in rules of HTML and PHP/ASP users are bound to rules, and compatibility on facebook there is no limits; thus entering website now a days, well what you see on facebook.com isn’t whats important, the site imports third party websites into your browser revealing sensitivity password information and potential security breaches, your spy-ware filter will not track this, since the code is original and undetected, look around on the web, you people need to understand not only about safety but the site you all love isn’t what it once was, if you need any help my website will offer appropriate council and solutions.
Try:
javascript:elms=document.getElementsByName(“checkableitems[]“);for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()};
it works!!!
Looks like facebook changed their code around the middle of august to stop working, they now use a popup iframe which will be a lot harder to get around….