One click to Accept/Delete all friend requests on Facebook




Have you received hundreds of friend requests and the list kept getting longer and longer and you never seem to clean that up?

Facebook currently do not have an option to simply select all and Accept or Delete.

In this short blog I'll demonstrate how to do it using JavaScript:

  1. Go to your friend requests page: https://www.facebook.com/friends

  2. Click on the Friend Requests Icon

  3. Open the JavaSccript Console:

  4. Chrome: Cmd + Option + J (on a Mac) or Ctrl+Shift +J (on Windows).

  5. Firefox: Cmd + Option +K (on a Mac) or Ctrl+Shift +J (on Windows).

  6. Paste the script below and hit enter !

  7. Now see the magic happening !

To Accept all your friend requests:


var action ="Confirm";
var inputs = document.querySelectorAll('[role="button"]');  
for (var i = 0; i < inputs.length; i++) {
    var labelstr = inputs[i].getAttribute("aria-label");
    console.log(labelstr);
    if (labelstr)
        if(labelstr.startsWith(action))
            inputs[i].click();
}

To delete all your friend requests

var action ="Delete";
var inputs = document.querySelectorAll('[role="button"]');  
for (var i = 0; i < inputs.length; i++) {
    var labelstr = inputs[i].getAttribute("aria-label");
    console.log(labelstr);
    if (labelstr)
        if(labelstr.startsWith(action))
            inputs[i].click();
}


Enjoy,