The first thing to do is add the namespace xmlns: fb = "http://www.facebook.com/2008/fbml" in the html tag (this will be interpreted FBML tags.)
\u0026lt;html xmlns = "http://www.w3.org/1999/xhtml" xmlns: fb = "http://www.facebook.com/2008/fbml">
the login button to add:
\u0026lt;fb:login-button autologoutlink="true" perms="publish_stream"> , \u0026lt;/ fb: login-button>
Finally we add this code
\u0026lt;div id="fb-root">
\u0026lt;/ div>
\u0026lt;script src = "http://connect .facebook.net / en_US / all.js ">
\u0026lt;/ script>
\u0026lt;script>
FB.init ({appId: ' YOUR APPLICATION ID ', status: true, cookie: true, xfbml: true });
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
// A user has logged in, and a new cookie has been saved
} else {
// The user has logged out, and the cookie has-been cleared
}});
\u0026lt;/ script>
We register our application to get the ID, that we realize from http://developers.facebook.com/setup/ to replace the above code should appear on the login button within the page
Please note:
- The application facebook should have the same domain as the page where the site is located, that is, if my application is in www.myserver.com on the same site should be hosted html.
- must have a valid ID of application.
- can choose the different permission to access the application.
0 comments:
Post a Comment