/    Sign up×
Community /Pin to ProfileBookmark

Facebook Invite All Friends Workaround?

Could you use something like this to workaround the lack of a “Select All Friends” button for Facebook groups, events and pages?

<html>
<frameset cols=”25&#37;,75%”>
<frame name=inviteall src=”inviteall.html”>
<frame name=main src=”http://www.facebook.com“>
</frameset>
</html>

and then inviteall.html looks like this:

<html>
<a target=”main” href=”javascript:elms=[I][U]top.frames[‘main’].[/U][/I]document.getElementById(‘friends’).getElementsByTagName(‘li’);for(var fid in elms){if(typeof elms[fid] === ‘object’){fs.click(elms[fid]);}}”>Click here to select all friends</a>
</html>

The bit underlined and in italics is a bit I added in whilst fiddling. It doesn’t work, but is there anything along similar lines that could make it work?

Thank you in advance for any help!

Edit:

[QUOTE]

javascript:elms=document.getElementById(‘friends’).getElementsByTagName(‘li’);for(var fid in elms){if(typeof elms[fid] === ‘object’){fs.click(elms[fid]);}}

[/QUOTE]

This bit isn’t mine, I found it. You normally have to use this by copying it and then pasting it into the address bar when you are on the “Select Friends” screen.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@svidgenJan 15.2010 — I can't imagine most browsers will allow you to do anything like this, with cross-browser scripting security issues and all. However, you could create/publish a bookmarklet that deals directly with a Facebook page. You basically just need to change your code to act as if it's already part of the page you're dealing with and pop it into your favorites.

I actually use bookmarklets at work to perform calculations in existing "apps" that are highly sensitive to change (or difficult to modify). They're pretty handy.
Copy linkTweet thisAlerts:
@GueztauthorJan 15.2010 — Thanks very much for your reply - I am very inexperienced with coding, so is there any chance you could walk me through it slightly more? I have used javascript a fair amount, but botch jobs that I've fiddled with using logic and guesswork rather than skill or experience!

By a bookmark I presume you mean just a url that is one long string that will essentially go to a specific facebook page/group, then open the select friends dialogue, and then select them all?
Copy linkTweet thisAlerts:
@svidgenJan 15.2010 — Not exactly. A bookmarklet is just a bookmark/favorite link like any other in your browser, except it holds script instead of a URL. So, you craft a link as if it were present on the page you're viewing, but add it to your browser instead.

See Svidgen's About page. The giant add2svidgen link is meant to be added to your browser's links bar. It takes attributes from the page you're currently viewing and processes them ... however you want. A bookmarklet can even insert a script from another site into the page, allowing the script to run as though it were part of the page. It's a bit sneaky and could potentially cause some trouble for some sites--but it's perfectly doable.

For instance, the following link changes the background of a page to blue for the current page-viewing:
[code=html]<a href="javascript:void(document.body.style.backgroundColor = '#0000FF');">Turn page blue</a>[/code]
To turn this into a bookmarklet, either bookmark the link from a page, or add a new blank bookmark and set the URL to the HREF string, including the [B]javascript:[/B] prefix. All of a sudden-like, you can turn any page you're viewing BLUE! (for that page-view only, of course).

And of course, you can interact with the page [almost] any way you like, even adding external scripts to it, as I said before. It's often easiest to build a generic bookmarklet that adds a script to a page which does the real work. You can then update that script as often as you like without having to edit your bookmarklet, which of course, probably has a character limit of around 2k ...

Make sense?
×

Success!

Help @Guezt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...