Today i am using facebook invite friend api in my project .Before using of below code you have to create a Facebook application at developers.facebook.com click here like below preview.
If you like this post please don't forgot to notify me to post a comment .
Happy Coding Guys :)
Code : You have to modify appId value with your APP_ID :
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'APP_ID',cookie:true,
status:true,
xfbml:true
});
function FacebookInviteFriends()
{
FB.ui({
method: 'apprequests',
message: 'Your Message diaolog'
});
}
</script>
BELOW IS THE HTML CODE :
<div id="fb-root"></div>
<a href='#' onclick="FacebookInviteFriends();">
Facebook Invite Friends Link
</a>
Code IFrame : The following code is for breaking Iframe, include this code into your webpage.
<script type='text/javascript'>
if (top.location!= self.location){
top.location = self.location
}
</script>
Below is the sample window of Facebook Invite friends :
If you like this post please don't forgot to notify me to post a comment .
Happy Coding Guys :)
And where is PHP code...?
ReplyDeleteHello @RR-team,
ReplyDeleteNo need of php. Here you need simple javascript that i am using.
Thanks..
no one can receive the invitation what should i do
ReplyDeleteSEND INVITATION SUCCESS BUT NOT RECEIVE ANY NOTIFICATION OF MY FRIEND,
ReplyDeletePLEASE SUGGEST ME.
Hi @chetan..
ReplyDeleteI thing this is the problem in your facebook app configuration. Please try to follow the below configuration.
You just need to go in to the Facebook developer and select your app and goes in to the setting of your app and click "Add Platform" and select "App On Facebook" and than add canvas url in it. Now try to send invitation and it will show the notification.
Inwizards is a Website and mobile app design and developement Comapny. We create website in many plateform like : HTML, PHP, Nodejs, asp.net, Angularjs.
ReplyDeleteHire Angularjs Developer
Hire Nodejs Developers
hire asp.net developer
ReplyDeleteThank you very much for your kind words.
Offshore Angularjs Developers
hlo,
ReplyDeletefriends show smoothly but notification not send to friend. please suggest..
Hi @Amit..
ReplyDeleteThanks for your comment. I thing this is the problem in your facebook app configuration. Please try to follow the below configuration.
You just need to go in to the Facebook developer and select your app and goes in to the setting of your app and click "Add Platform" and select "App On Facebook" and than add canvas url in it. Now try to send invitation and it will show the notification.
Please let me know if you still have any issue.
And where is PHP code...?
ReplyDeleteHi Fuse Angular,
ReplyDeleteThis code is work with javascript. There is not need of PHP.
I'm getting this error :-
ReplyDeleteGame Requests are only available to games.
Hi Quicky,
ReplyDeleteDid you add the APP_ID at this line "appId:'APP_ID'" ?
Show me your code that you are using.
Not work for me,showing error as below,
ReplyDeleteUncaught ReferenceError: FB is not defined