Purpose of a Facebook Auto Friends Request Program or Script
Save time. If you are popular on Facebook and get lots of friend requests, it gets tiring to keep click Confirm
button after Confirm
button. With a program or script that allows you to auto accept all friends request with a single click is going to be a huge time saving if you have dozens or even hundreds of pending friend requests.
Auto Accept Friend Requests is a Virus or Malicious Script?
There is a mistaken notion that any scripts or programs that auto accept friend requests on Facebook is a virus or malicious script and this is like saying that all people are bad. A script that allows you to auto accept all friend requests CAN be malicious or do something you don't want but an auto accept friend request script, or any script or program, for that matter, can be malicious.
A perfect example of this paranoia is if you are on Facebook using the Google Chrome browser, if you press the keycode combination to open the Javascript console (CTRL+SHIFT+J) in big, bold letters is a warning that running any automation related Javascript code is a scam. While code you run CAN or MAY be a scam, Chrome, understandably assumes the average persons knows nothing about Javascript code and errs on the side of paranoia to protect people using Chrome. The code we provide you below is NOT a scam which is why we go into great detail on this page about how this code works and how to use it.
Chromes warning about running scripts in Facebook.
Chromes warning about running scripts in Facebook.
How an Auto Accept All Friends Request Script Works
All web pages, including Facebook.com, are made up of what is called objects. While this is insignificant for the person browsing the web but, to the people who write code that interacts with web pages (such as myself and anyone who creates an auto friends request script for Facebook) objects allow you to control and interact with the elements of the web page. There are dozens of differnet types of objects on a web page including link objects, button objects, image objects, etc.
For the purpose of an auto friends request program or script, we are mainly concerned with button objects. The button you click that allows you to accept a friend request, the Confirm
button, is the key to being able to auto accept friend requests on Facebook.
If you are using Google Chrome for a web browser, if you right click one of those Confirm
friend request buttons, you will get a pop up menu with one of the menu entries labeled Inspect
.
Inspect Facebook Confirm Friend Request Button.
Inspect Facebook Confirm Friend Request Button.
Click the Inspect menu item and Chrome will open a panel in your web browser that shows you the important information you need to know to be able to auto accept all friend requests on Facebook.
Facebook Friend Accept Button InnerHTML.
Facebook Friend Accept Button InnerHTML.
The Javascript Code to Auto Accept All Facebook Friend Requests
Here is the javascript code to auto accept all friend requests on Facebook. Each line of code is commented to tell you what each line of code is doing and how the script works. Move your mouse over each line of code to see the comment and explanation of that line of code.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
function acceptFriendRequests(){
var counter=0, htmlCode, ipos;
var buttons = document.getElementsByTagName("button");
for (i = 0; i < buttons.length; i++){
htmlCode = buttons[i].outerHTML.toLowerCase();
ipos = htmlCode.indexOf("confirm");
if(ipos > -1){
buttons[i].click();
counter++;
}
}
alert(counter + " friend requests auto confirmed");
}
Download Code Sample Script to Accept All Facebook Friend Requests
If you would like to more closely examine this code and how it works, download facebook-autoaccept-friend-request.zip file which is a web page that has the html code for a part of the Facebook page where the friend requests are as well as the javascript code to accept all the friend requests.