Created
January 6, 2012 21:41
-
-
Save dandemeyere/1572523 to your computer and use it in GitHub Desktop.
Facebook Invites JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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