Skip to content

Instantly share code, notes, and snippets.

@dandemeyere
Created January 6, 2012 21:41
Show Gist options
  • Save dandemeyere/1572523 to your computer and use it in GitHub Desktop.
Save dandemeyere/1572523 to your computer and use it in GitHub Desktop.
Facebook Invites JS
// FB invite data
var button, display, div, facebook_friend_id, ie, message, self;
message = 'Dan DeMeyere has invited you to join thredUP, an online marketplace where moms like you buy, sell & share children\'s clothes, toys and books online.';
facebook_friend_id = button.parent().attr('friend_uid');
// Detect browser and set the compatible Dialog display type
div = document.createElement('div');
div.innerHTML = '<!--[if IE]><i></i><![endif]-->';
ie = div.getElementsByTagName('i').length === 1;
if (ie) {
display = 'popup';
} else {
display = 'iframe';
}
// Make the call
FB.ui({
method: "apprequests",
message: message,
display: display,
to: facebook_friend_id
}, function(response) {
facebook_request_id = response.request_ids[0];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment