I have read other similar questions but i didn't find any answer to my problem.
I created a facebook application and in my server, in the app folder i have an error log created, which contains this message repeated in many dates: Could not set cookie. Headers already sent.
My app consist of a header.php which starts with the "!DOCTYPE html" in <> continues with the
"html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"" in <>
in the head part it has the "meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/" in <> and the body is like that:
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php echo $app_id;?>', status: true, cookie: true, xfbml: true});
Any suggestions on what is going wrong?
Thank you in advance.
Related
I'm trying to get the registration flow for Facebook login working. Here's a bare-bones example:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>My Facebook Login Page</title>
</head>
<body>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<div id="fb-root"></div>
<script type="text/javascript">
FB.init({
appId:'xxxxxxxxxxx',
cookie:true,
status:true,
xfbml:true,
channelUrl : 'http://<myWebSite>/channel.html',
oauth:true
});
</script>
<fb:login-button registration-url="http://<myWebSite>/register"/>
</body>
</html>
(The only things I've replaced above are the website and the appID)
If I try it like this, the login button shows up, but clicking it causes FireBug to report 'Unknown status: undefined' in the browser log. If I remove the 'oauth=true' line though, it works. I'm trying to adhere to the new oauth 2.0 standard, so I'd like to leave it in. Has anyone else run into this? Seems like if this was a bug, it would have been caught pretty early on.
the 'registration-url' parameter is no longer supported by , take a look in the documentation of it. http://developers.facebook.com/docs/reference/plugins/login/
Just check if the user is logged in via the JS-SDK
This is a newbie question. I am unable to find an example (in HTML) to get started on Facebook's FQL API.
This is what I have currently:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#appId=216492851715113&xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<script>
FB.init({
appId: '216492851******',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
</script>
<script>
FB.api(
{
method: 'fql.query',
query: 'SELECT name, pic_small FROM user WHERE uid=me()'
},
function (response) {
alert('Name is ' + response[0].name);
}
);
</script>
</body>
</html>
And I am expecting to see my name display in an alert (because I am logged on to Facebook).
At first I think it wasn't working because I am using localhost, but I have already modify my Host file to match up the URL I provided to Facebook.
I am guessing this is a session issue because if I changed the query to use a hard coded ID:
'SELECT name, pic_small FROM user WHERE uid=696190859'
It would work.
Try this:
http://api.facebook.com/method/fql.query?query=SELECT%20name,%20pic_small%20FROM%20user%20WHERE%20uid=696190859&format=JSON
or more specifically:
query: 'SELECT%20name,pic_small%20FROM%20user%20WHERE%20uid=me()'
you need to make sure the url is encoded. See here:
http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
Hopefully that works?
You need to make sure the user has authenticated with your application by calling the FB.login() or validate that they have already authenticated by calling FB.getLoginStatus(). Otherwise, me() won't exist as you are experiencing because they haven't authenticated.
I have the Facebook invite feature on a site that I am working on and all of a sudden it stopped working. Here is what I have:
window.fbAsyncInit = function() {
FB.init({ appId: '145554402127660', status: true, cookie: true, xfbml: true });
};
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<fb:serverFbml width="565px">
<script type="text/fbml">
<fb:fbml>
<fb:request-form method='POST' invite=true
type='Our site'
action='http://somesite.com/step3'
content='this is the place you want to be'>
<fb:multi-friend-selector cols=3
actiontext="Invite your friends to join you our site"
/>
</fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>
This worked before, but now for some reason I always get this error:
1 XFBML tags failed to render in 30000ms.
Any ideas on what is happening and why this stopped all of a sudden? Also, if there is a new way of doing this, maybe with the Graph API, I would highly appreciate info about it.
got namespace xmlns:fb="http://www.facebook.com/2008/fbml" ?
the answer is here - Facebook FXBML since Yesterday not rendering (IFRAME Canvas)
You'll have to call FB.XFBML.parse after FB.init is complete.
The newest way of doing this is through the Requests 2.0 Dialog, part of the Graph API. It's about 2 months "old". It works through the javascript API.
http://developers.facebook.com/docs/reference/dialogs/requests/
http://developers.facebook.com/blog/post/464
I am using the facebook connect to login into my website.
In my html page i writen the code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test JOpenID </title>
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'180065668680582',
cookie:true,
status: true,
xfbml:true
});
</script>
<fb:login-button perms="email,user_checkins">
Login with Facebook
</fb:login-button>
</body>
</html>
So when i click on Login with Facebook button a window pop up and ask to fill the username and password. Till this time everything works properly. Problem persist when i click allow button to enter into the destination web-site. A pop up window appear and disappear also. The till of the window was XD proxy and at the url it is ::
http://static.ak.fbcdn.net/connect/xd_proxy.php#cb=f183a80ac008141&origin=http%3A%2F%2F174.129.214.219%2Fff715e2f856e19&relation=opener&transport=flash&frame=f1d4f8afdf94ebe&result=%7B%22perms%22%3A%22email%2Cuser_checkins%22%2C%22selected_profiles%22%3A100001492618815%2C%22session%22%3A%22%7B%5C%22session_key%5C%22%3A%5C%222.pRXlnxq8Ig6QwZyJsG732w__.3600.1294326000-100001492618815%5C%22%2C%5C%22uid%5C%22%3A%5C%22100001492618815%5C%22%2C%5C%22expires%5C%22%3A1294326000%2C%5C%22secret%5C%22%3A%5C%225pe7qxMU_7DitJucmcyftA__%5C%22%2C%5C%22access_token%5C%22%3A%5C%22180065668680582%7C2.pRXlnxq8Ig6QwZyJsG732w__.3600.1294326000-100001492618815%7C_QjDI7eTUD32QVvapbsqxn-r4DE%5C%22%2C%5C%22sig%5C%22%3A%5C%22aa66a1d8b234ebe863e386bb8a6520e7%5C%22%7D%22%7D
As per my requirement is concerned i need after allow the facebook is should allow me to enter to the destination site which i already registered. But it only onen a window and disappear in a second.
What is the issue and how to solve tell me in details...
Thanks
don't use
FB.init({ apiKey: 'API_KEY' });
and use
FB.init({ appId: 'APP_ID', status: true, cookie: true, xfbml: true });
To fix it in Opera, just att the following after FB.init():
if($.browser.opera ) // it uses jQuery library here!
{
FB.XD._transport="postmessage";
FB.XD.PostMessage.init();
}
I've been experiencing the same issue in IE9, and it seemed to stem from upgrading to Flash Player 10. I'd lost hope in trying to fix it since finding an open bug at Facebook covering it. But Henson has posted an answer that fixed it for me. In the JavaScript in my site master I removed the lines
FB.UIServer.setLoadedNode = function (a, b) {
//HACK: http://bugs.developers.facebook.net/show_bug.cgi?id=20168
FB.UIServer._loadedNodes[a.id] = b;
};
and now it works. (N.B. I have not checked to see if the IE8 issue those lines were intended to overcome returns.)
Sometimes iv'e got the problem that no facebook fanbox is load on my companies website Friseursalon München. Can't find a problem in the fbxml code:
<fb:fan profile_id="395375265611" connections="10" width="334" height="285" css="http://www.x-hair.de/cms/css/facebook.css"></fb:fan>
Any suggestions? Anybody else with the same issue?
Thanks,
Stephan
I don't see any mistakes in the facebook fan code.
You should add the facebook xmlns string at the top of your page:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
This solved some problems for me in Internet Explorer.
You could try to load the newest version of the js SDK.
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: 'your app id', status: true, cookie: true, xfbml: true});
</script>