FB.init({
appId:'Application ID', cookie:true,
status:true, xfbml:true
});
FB.ui({ method: 'apprequests', message: 'Here is a new Requests dialog...'});
How to redirect the user to my external website rather than the Canvas Page inside facebook?
There are a couple posts about this online that suggest making a dummy canvas page that sets
window.location.top = 'yoursiteurl'
... but this does not seem satisfactory to me. Facebook docs are wildly unclear about whether external website ("Facebook Connect") devs are encouraged to use requests.
Related
In my website I want to integrate the "Invite your friends to like this Page" similar to the Facebook Fan Page(Any), where people can search a friend and send an invite to like a page, after receiving and clicked that notification the user will be redirected to the Facebook Fan Page.
This what I do, by adding an App and Creating a Facebook Canvas in the Developer Tools and with this piece of code in my website:
window.fbAsyncInit = function() {
FB.init({
appId : '577325869064730',
cookie : true,
xfbml : true,
version : 'v2.2'
});
};
function sendInvite() {
FB.ui(
{
method: 'apprequests',
message: "I am inviting you to like my page"
},
function(response) {
console.log(response);
}
);
}
It seems do the work, but the problem is it is not really the one I'm expecting because, It's not redirecting to the my Facebook Fan Page and the Facebook canvas URL only allowed a secure URL ("https") and doesn't allow the URL Facebook.
Is there a workaround for the redirection of the URL, rather than redirect to the declared URL in the Facebook canvas it should be pointed to my Facebook Fan Page. And the result should be the FULL Page of the Facebook Fan Page not in the Canvas.
Can this be done?
apprequests are for inviting friends to a game app on Facebook Canvas, not for inviting them to a Page (APP requests, hence the name). It will always redirect to the Canvas Page.
Better use the Send Dialog or Share Dialog. Of course you donĀ“t need https for those.
So far I was able to find a way to redirect it on the Facebook Fan Page, I just don't know if this is the correct solution:
In the website header, the one I declared in the Facebook Canvas URL:
I inserted this code:
<script type='text/javascript'>
top.location = "www.facebook.com/fanpage"
</script>
It is now redirecting to the Facebook Fan Page.
I'm struggling to create my first Facebook share feature on a website and the issue is a dynamically created link. I'm trying to share a referal link to (i.e. come checkout ecommerce site and get $20 back).
<script type="text/javascript">
$(document).ready(function(){
$('#share_button').click(function(e){
e.preventDefault();
FB.ui(
{
method: 'feed',
name: 'Want $20 off Sailormade bracelets for summer? Shop now and thank me later',
link: '<?php echo $this->getReferrerLink();?>',
picture:'http://shop.sailormadeusa.com/media/wysiwyg/raf/refer_a_friend_static_block.jpg'
});
});
});
First timer on the Facebook app, and first timer posting here on stackoverflow. Go easy on me, and let me know if I can provide any additional information. THanks!
Hi so I am making a Facebook app which uses the send dialog. I was wondering why it doesn't work when I put 'https://apps.facebook.com/APP_NAME/' as my link parameter. I want the link in the send message to be a link to my app but on the send dialog is appears as apps.facebook.com. Is there anyway to do this?
Edit: Yes sorry here is the code:
<script>
FB.init({appId: 'App_ID', xfbml: true, cookie: true});
function sendMessage(){
// assume we are already logged in
var token = FB.getAuthResponse().accessToken;
FB.ui({
method: 'send',
name: 'Test',
link: 'https://www.apps.facebook.com/APP_NAME',
description: 'This is a test',
picture: '',
display: 'iframe',
access_token: token
});
}
</script>
If you dont want the apps.facebook.com domain showing up in the caption for the post, you ca theren create a new page in your site. Set all the og meta tags to what you want to show up in the feed. The only other content in the page should just be a javascript redirect to your you canvas app. This way when FB scrapes your site, they get all the necessary data and when a user clicks on the link, the js redirects them to your app.
Also, there is not a "www" in the url for app canvas pages.
I have an invite dialog on my page:
<a href="#" onclick="sendRequestToManyRecipients(); return false;" >xx</a>
<script language="javascript" type="text/javascript">
FB.init({appId : 'myappid', status : true, cookie : true, oauth: true});
function sendRequestToManyRecipients() {
FB.ui({ method: 'apprequests', message: 'xxx'},requestCallback);
}
function requestCallback(response) {
// Handle callback here
}
</script>
When the invited user clicks the invite, he gets linked to the app, but I want the user to get redirected to a page like http://www.facebook.com/pages/xxx/xxx?sk=app_xxxx.
How can I do that?
That's not possible without some custom coding - the requests interface exists to drive traffic to apps on facebook, not to page tabs, there's no way to have Facebook send users to a tab when they accept the request.
You could just implement something on your canvas landing page that redirects users back to a page tab based on the information in the request as a workaround.
previous version of the apprequest which is request-form this was possible: How can I include a link in a FB app request?
However current version of apprequest : facebook guys lets only redirect to your app: https://apps.facebook.com/yourapp
#Vihay comments helps this custom workaround to redirect to page.
Hoping next version apprequests, facebook enables redirect to links within the fb app.
Agree with previous answers. Facebook will redirect to your app, which is just a Facebook wrapper around a page you can provide. That page can then use a client-side redirect to whatever page you'd like (like what Klout does).
I would like to allow users on my website to send invitations TO my website to their facebook
friends. What is the best way to do this?
Is there a simple snippet of FBML code I can attach to a button on my site?
Must the users first be logged into facebook?
In the developers documentation here:
http://developers.facebook.com/docs/reference/fbml/req-choice/
It says "Note: You can also send requests and invites through Inbox."
What does this mean?
Thanks.
In all honesty, the simplest way is to use Like. Add in the correct Open Graph tags and you will have your website published on their wall. By using Like, if the person isn't logged into Facebook, it handles all of that side of things for you.
EDIT
http://facebook-developer.net/2008/02/20/allow-your-users-to-invite-their-friends/
EDIT
You said you wanted to invite people to your page. Here is the code:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js">
</script>
<script>
FB.init({
appId:'YOUR_APP_ID', cookie:true,
status:true, xfbml:true
});
FB.ui({ method: 'apprequests',
message: 'Here is a new Requests dialog...'});
</script>