How to Mass Invite Friends to Events and Fan Pages on Facebook

In the rare occasion when I am trying to mass promote an event or fan page on Facebook, I always find it tedious to have to select all of my friends for the invite. Granted, I have a very good idea of who I should invite to the event or page, but sometimes I forget or assume that certain people wouldn’t take interest what I am promoting.  Like anyone else, I’d much rather have the daunting task automated for me.

Facebook is constantly changing their website behind the scenes, and with these changes, old code tricks do not seem to work anymore.  Fortunately, I was able to find this script and it works out great with the current version of Facebook (July, 30, 2011).

By pasting the following code into the URL box and hitting enter, this will execute a loop that will check all unchecked boxes. You can even see the process occur in realtime:

javascript:elms=document.getElementsByName(“checkableitems[]“);currentFriendClick=0;friendClickTotal=elms.length;friendClickInterval = setInterval(“clickCurrentFriend()”, 15);
function clickCurrentFriend()
{
if(elms[currentFriendClick].type=”checkbox”) elms[currentFriendClick].click();
currentFriendClick++;
if(currentFriendClick >= friendClickTotal) clearInterval(friendClickInterval);
}

Also, it’s important to check for the javascript: before elms= in the URL box. I’ve come to find that FireFox and Google Chrome strip out the declaration.

If you are having problems with copying and pasting this script, please read the update below.

When using this script, though, you must understand that when the the invite window appears to invite your friends, not all of your friends have been loaded. Facebook uses a lazy loading function to optimize performance. To ensure that you are actually inviting all of your friends, keeping scrolling in your friends list until the scroll bar is at the absolute bottom and doesn’t jump. You’ll know because your friends are arranged alphabetically by last time.  Below are some visual examples of what I am trying to convey.

Facebook Friend Invite Screen

The initial screen that pops up for event invites.

To reiterate, you’ll notice the scroll bar constantly moving up a few notches as you get closer to scrolling to the bottom until you reach the end of your friend’s list. Once you hit the bottom of the list, paste the provided code into the URL bar and watch the script do its thing.

I tested this using Google Chrome 12.0.742.122 and it worked flawlessly. Let me know how it works in other browsers.

Update: If copying and pasting the above text does not work, please visit this text file and copy and paste the code from it instead.

I also noticed that Google Chrome now strips out the javascript: portion at the beginning of of the code. Make sure you manually retype this back in for the script to work. Otherwise, you will be taken to a Google search result instead.

, , ,

54 Responses to How to Mass Invite Friends to Events and Fan Pages on Facebook

  1. marc July 31, 2011 at 3:26 am #

    damn it doesn’t work anymore!

    • Brett Widmann July 31, 2011 at 3:27 am #

      It should! I tested it before I published this blog. Let me check it out.

      Correction: It does indeed work, but I think the text formatting throws it off. I’ll throw it in a text file and link to it on here. Thanks for catching this, Marc!

      • marc July 31, 2011 at 1:51 pm #

        still doesn’t work. oh welllllllll!

        • Brett Widmann July 31, 2011 at 11:16 pm #

          Still works for me :P

    • Louis August 20, 2012 at 6:14 pm #

      First got to Mozilla Firefox’s TOOLS, then select “WEB DEVELOPER” then select “SCRATCHPAD” you will see the following screen on the page:
      /*
      * This is a JavaScript Scratchpad.
      *
      * Enter some JavaScript, then Right Click or choose from the Execute Menu:
      * 1. Run to evaluate the selected text,
      * 2. Inspect to bring up an Object Inspector on the result, or,
      * 3. Display to insert the result in a comment after the selection.
      */
      On the flashing blue highlighted line enter the following script (or copy/paste – CTRL V):
      javascript:elms=document.getElementsByName(“checkableitems[]“);for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()};

      Once you are done, then select “EXECUTE”, then “RUN”. You should see your friends checked off, then just “SAVE” at the bottom and that’s it.

  2. Tonic August 11, 2011 at 5:20 pm #

    I have tried the code in Chrome and Explored and it just keeps going to a search window of sites where the code is listed….any new codes?

    • Brett Widmann August 12, 2011 at 11:01 am #

      The code still seems to work for me? Since I notice that people are having issues, I am tempted to make a screen cast of how the process works from start to finish.

    • Brett Widmann August 13, 2011 at 5:10 pm #

      I found your problem: Chrome strips out the javascript: portion before elms. You need to add that and then it will work.

  3. Joris Cielen August 16, 2011 at 8:18 am #

    Months ago it worked fine but now it doesn’t work anymore. Damn

    • Brett Widmann August 16, 2011 at 8:24 am #

      What browser did you try it in? It still works for me. I use Google Chrome.

      I think I need to rewrite and update this article.

      Thanks for the comment and the heads up! :-)

  4. Blume August 25, 2011 at 1:29 am #

    I can’t get it to work in Chrome or in Firefox. In Chrome, it keeps doing a “search” on the javascript when I paste it into the url and hit enter… Help please!

    • Brett Widmann August 25, 2011 at 1:46 am #

      What’s happening is that the javascript: portion is getting stripped out of the code when you paste it into the URL bar. Make sure to scroll to the beginning and place this before elms=.

      In essence, the JavaScript declaration is being removed… probably to prevent hacking.

  5. James August 26, 2011 at 1:22 pm #

    You saw copy and paste this… But where do you paste it? into the URL box or what?

    • Brett Widmann August 26, 2011 at 1:24 pm #

      Yes, into the URL box. I’ll make that more clear.

      Also, when you copy and paste into the url box, please check to make sure that the javascript: declaration before elms isn’t stripped out. Google Chrome and FireFox automatically do this.

  6. James August 26, 2011 at 1:26 pm #

    when I do that it goes to a page not found. Am I supposed to put it after the facebook url? or by itself?

    • Brett Widmann August 26, 2011 at 1:27 pm #

      By itself; clear out the URL box, and paste.

      • James August 26, 2011 at 1:28 pm #

        It doesnt do anything. I made sure the javascript part was in there. Are you still able to do it? I am in Chrome…

        • Brett Widmann August 26, 2011 at 1:31 pm #

          Let me check right now. I have a few events I can test with.

        • Brett Widmann August 26, 2011 at 1:34 pm #

          It still works fine for me. I am wondering that since so many people are having issues if I should just screen cast it and go from there. Also, I have a text file containing the code, too. Maybe there’s additional formatting occurring behind the scenes?

          • James August 26, 2011 at 1:35 pm #

            How long does it take to work? I let it sit for a few minutes because I read that it may take a while. I have like 2000 friends.

          • Brett Widmann August 26, 2011 at 1:37 pm #

            It’ll take awhile since it has to loop through all of them. Make sure you scroll all the way to the bottom of the window that pops up containing all of your friends. The window lazy loads as you scroll to the bottom until you get to the bottom of the list. The list is alphabetical. Otherwise, you won’t invite everyone on your list.

            Yup, pretty sure it’s time to make a screencast. I apologize for all of the confusion.

  7. James August 26, 2011 at 1:40 pm #

    No it works. I just tested it on a small group I custom made. And it checked them quickly. I’m going to do it on all my friends and let it sit for a while and come back. I’ll let you know. This actually works very well. Just describe more in detail that you need the pop up window open, and you need to paste it over the URL and then make sure the word javascript: is still in the front.

    • Brett Widmann August 26, 2011 at 1:41 pm #

      I made an edit in the blog post. Should be good for now. I’ll probably re-write the article at the very least. Thanks for commenting and asking questions! I appreciate it.

  8. James August 26, 2011 at 1:48 pm #

    No worries. Thanks for posting this. Great little tool!

    • Brett Widmann August 26, 2011 at 1:55 pm #

      Not a problem! Glad it works for you!

  9. James August 26, 2011 at 3:00 pm #

    Seems to only work in webkit browsers. Safari and Chrome. Did not work for me in Firefox or IE.

    • Brett Widmann August 26, 2011 at 3:01 pm #

      Interesting. What version of FireFox? I did my testing in FireFox 5.

  10. James August 26, 2011 at 3:02 pm #

    Mine is 6.

    • Brett Widmann August 26, 2011 at 3:05 pm #

      Looks like you’re correct.

      FWIW, it also fails in Opera.

      Well, back to the drawing board, I guess. Thanks for the testing!

      • James August 26, 2011 at 3:26 pm #

        no problem. great website btw.

  11. Tee Bee September 6, 2011 at 6:47 pm #

    Thanks so much.. the code worked for me! i had to use the code that u posted in the “update” yay! it worked! Im so happy.. u just gave me back a few hours of my life… i was about to have to select 4200 people one by one… = )

    • Brett Widmann September 6, 2011 at 6:49 pm #

      Glad I could help someone! I am still in the process of revamping this post. It seems there’s a lot of misunderstandings and it looks like the code only works in Chrome?

      Thanks for the comment. Glad I was able to save you some time!

  12. Metwo October 12, 2011 at 3:16 pm #

    By the Beard of Moses I just tried it, and it worked. At first it only highlighted 40+ friends then I waited and BAMMMMM!!!!!!!!!!!!!! All 1200 of my friends were selected in no time. Thanks for saving me so much time

  13. S3nd41 November 22, 2011 at 7:20 pm #

    Thanks for the excellent code. At the beginning it was not working on Chrome because I forgot to check for “javascript:” on the start, you have to manually add it every time you copy-paste the code. Real time saver, people are starting to pour in my pages :)

    • Brett Widmann December 15, 2011 at 12:45 am #

      Glad you enjoyed the code snippet! I still gotta write working versions for FF, IE, and Opera. :-O

  14. Vincent December 19, 2011 at 9:29 pm #

    I’ve tried using this on Chrome, with adding “javascript:” at the beginning of the code and nothing happens. I have over 4,500 friends. Is that possibly the problem?

    • Brett Widmann December 20, 2011 at 7:27 pm #

      That could be. I’ve tried it with roughly 1,600. I’m pretty sure there is a comment on this post that stated at least a few thousand. I’ve recently used the code (last week), and it still worked like a charm for me.

      Did you scroll all the way to the bottom of your friends list so that the lazy loading feature loaded all of your friends? Also, did you scroll back up to the top of your friends list to make sure the script started? Just checking the basics, just in case :)

      • Vincent December 21, 2011 at 1:39 am #

        not sure why but it just worked one time. i closed and re-opened the browser a couple times. who knows.

        bottom line: thank you.

        • Brett Widmann December 21, 2011 at 10:48 am #

          Odd. Thanks for letting me know, though!

          You’re welcome.

  15. Becky December 27, 2011 at 2:32 pm #

    Code worked but Facebook is giving me the error that I need to narrow my selection… and then not sending the invites out. Any suggestions on that?

    • Becky December 27, 2011 at 2:38 pm #

      It says.. the following EXACTLY….

      Can’t Send Invite
      Please narrow your invite list to friends who are most likely to be interested in this event.

      If you’ve gotten this message in error, visit this form.

      • Brett Widmann January 15, 2012 at 2:43 pm #

        Sorry for the late response on this one, Becky.

        What happens is that Facebook doesn’t like when you invite an X percentage of people on your friends list. It’s sort of their way of combatting spam and mass invites.

        What I do is that I go back and uncheck people that I know won’t attend the event/page, and that seems to help.

        I have also noticed that even if the error does pop up, it still goes through and works.

  16. Nikhil Gala January 15, 2012 at 8:52 am #

    In chrome, Google search engine result appears for above script. Didn’t work for me. :| Fail.

    Finally, I tapped Tab and spacebar and selected all my friends, though frustrating but could select all of them in 8 minutes :)
    @nicks25 on twitter

    • Brett Widmann January 15, 2012 at 2:39 pm #

      Good thinking! It works, but is still faster than manually checking everyone.

      The reason why the script gave you a Google search result is because you may have forgotten to add “javascript:” as that part of the code gets stripped in the URL bar.

  17. Bill A. February 18, 2012 at 9:41 am #

    Downloaded chrome , won’t work , firefox , won’t work , IE won’t respond ….manually added javascript: ….when I hit enter it just goes back to the original FB url like I never put anything in . I have 5k friends , but clicked about 1k away thinking that may help , nope , back to clicking

    • Brett Widmann March 5, 2012 at 3:03 pm #

      In chrome, did you make sure the text “javascript:” was present before the elms declaration? Chrome strips out the aforementioned text, so it needs to be added after you paste the code and before you hit Enter.

  18. Fee March 10, 2012 at 9:32 am #

    Worked great on safari, thanks!

  19. sapphiredragon April 17, 2012 at 10:07 pm #

    Thank you Brett Widmann! Worked like a charm on chrome v18.0!

  20. Bloggers Lab April 28, 2012 at 2:43 am #

    I’m extremely inspired along with your writing abilities and also with the format in your blog. Is that this a paid subject matter or did you customize it your self? Either way stay up the nice high quality writing, it’s uncommon to look a great weblog like this one these days..

  21. Khurram August 31, 2012 at 5:39 am #

    How much time would it take?

  22. Sharon October 9, 2012 at 8:09 pm #

    Yes it works, finally thank you. YOu need to put the javascript at the front, and wait a few seconds. I thought it wasn’t doing anything at first, but it takes a little while to tick all the boxes on the list

  23. Garry LachmanG January 17, 2013 at 10:41 am #

    You can use this Chrome Extension, this more easy:

    http://chrome.google.com/webstore/detail/facebook-invitethemall-fo/jladghljinmlokelojmdmblikkifabea

Trackbacks/Pingbacks

  1. (JavaScript) Mass Friend Event and Fan Page Invite for Facebook - July 31, 2011

    [...] Copy and paste this code into the URL box and press enter. You will see it happen in realtime. Make sure all of your friends are loaded first, as Facebook uses lazy loading! To learn more, visit my blog post on it at http://www.brettwidmann.com/2011/07/mass-invite-friends-facebook [...]

Leave a Reply