Facebook Canvas application using Javascript SDK
Hope someone can help me out. I have a facebook canvas application. I'm using this code to authenticate
window.fbAsyncInit = function() {
FB.init({ appId: '123842974364777',
status: true,
cookie: true,
xfbml: true,
oauth: true});
this.vars = {
access_token: '',
album_id: '',
items: '',
user_id: '',
photo_path: '',
errorHandler: 'There was a problem posting your picture!<br> Please contact <a href="mailto:support@eshots.com">support@eshots.com</a>',
counter: 1
}
authenticate();
function authenticate() {
FB.getLoginStatus(function(response开发者_如何学Go) {
if(response.authResponse) {
// logged and known to app
// store access token
vars.access_token = response.authResponse.accessToken;
sendUserInformation();
} else {
// not logged in or unknow to app
// prompt user to authorize app
FB.login(function(response) {
if(response.authResponse) {
// store access token
vars.access_token = response.authResponse.accessToken
sendUserInformation();
}
}, {scope: 'email,read_stream,user_birthday,user_photos,publish_stream'});
}
});
}
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol
+ '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
My problem is, running this code doesn't show my page in a facebook iframe. it just stays on the web domain. What I need is to get this page shown in a facebook iframe.
What do I have to add to make this happen?
Any help is appreciated!
Have you set your canvas url/secure url in the developer app to point to your canvas code?
This should essentially point to your domain like http://mydomain.com/mycanvasfolder where the canvas folder would have the index page you want to show.
You should be able to see a basic page without any other configuration or FB stuff.
精彩评论