I recently created the Facebook page for Wisdom Geek. And obviously, the first step was going to be inviting all my Facebook friends to like the page! But lazy me wanted to keep the trouble of clicking invite manually away and having done so successfully via VB script and javascript in the past, this time, was not going to be any different. I googled the script and found that Facebook keeps changing the tag name of the links it creates in order to avoid people from automating this process. So instead of just putting the code to invite all friends on Facebook, I will explain how javascript works and what the code is doing. So that you can use it at any point in the future even if Facebook changes the classes and tag names. I am explaining the technique and what the code means so that you can easily do it on your own next time.
javascript:var inputs = document.getElementsByClassName('_1sm'); for(var i=0;i<inputs.length;i++) { inputs[i].click(); }
The script explained:
document.getElementsByClassName searches the whole HTML page for elements that contain the parameter passed in and returns an array of objects that match it. You then simply are iterating over these in a for loop and clicking them programmatically. So the next time you try it, and if it returns ILLEGAL or unexpected token ILLEGAL or something else (doesn’t work in short), just right click and inspect element on a button. Check the class attached to the <a href=””> tag of the button and replace ‘_1sm’ with the ending instead. And if it still is ends in ‘_1sm’, just remove the quotes and type them in again. Many times the encoding of characters gets changed when copying quotes.
That’s how you can mass invite Facebook friends to like a page. And if you have any troubles let us know in comments!
PS don’t forget to like the Facebook Page for WisdomGeek. Cheers!
I recently switched completely to the Brave browser and have set ad blocking to aggressive…
I was preparing a slide deck for a hackathon and decided to put in a…
I have been using npx a lot lately, especially whenever I want to use a…
Manually copy-pasting the output of a terminal command with a mouse/trackpad feels tedious. It is…
While working on a project, I wanted to do an integrity check of a file…
Popovers have been a problem that was typically solved by using a third-party solution. But…
View Comments
Niceeeeee....
Thanks brother :)