After encountering some weird behaviour of facebook login session on client side,
i just realized that the flow of the code have to be correct.
window.fbAsyncInit = function(...);
the code above should come first, before including facebook js file below:
[script]http://connect.facebook.net/en_US/all.js[/script]
Showing posts with label facebook. Show all posts
Showing posts with label facebook. Show all posts
Monday, March 19, 2012
Sunday, October 31, 2010
Facebook fb-req-form howto?
Ive found many misleading website which teach some of the old facebook way of doing things.
There fore, the new example in the facebook php library is the latest concept, where the parameter are passed in via array of keys.
First, setup the namespace into html tag:
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<html xmlns:fb="http://www.facebook.com/2008/fbml">
Init the page via code in body, somewhere before /body
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '[your_app_id',
session : [php code], // please refer to php example which comes with facebook official library
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
You do not need to include the FeatureLoader.js.php. I belief this include is meant for old Facebook api.Hope this works for you :)
p/s: facebook always change their api, therefore, if it doesnt work, try to google around :)cheers~
Subscribe to:
Posts (Atom)