Advertisement
Guest User

Untitled

a guest
Dec 18th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <div id="fb-root"></div>
  2. <script>
  3. // Additional JS functions here
  4. window.fbAsyncInit = function() {
  5. FB.init({
  6. appId : '303594953085775', // App ID
  7. channelUrl : 'http://keytraining2.kentadulteducation.co.uk/pages/account/channel.html', // Channel File
  8. status : true, // check login status
  9. cookie : true, // enable cookies to allow the server to access the session
  10. xfbml : true // parse XFBML
  11. });
  12.  
  13. // Additional init code here
  14. FB.getLoginStatus(function(response) {
  15. if (response.status === 'connected') {
  16. // connected
  17. } else if (response.status === 'not_authorized') {
  18. // not_authorized
  19. login();
  20. } else {
  21. // not_logged_in
  22. login();
  23. }
  24. });
  25. };
  26.  
  27. function login() {
  28. FB.login(function(response) {
  29. if (response.authResponse) {
  30. // connected
  31. testAPI();
  32. } else {
  33. // cancelled
  34. }
  35. });
  36. }
  37.  
  38. function testAPI() {
  39. console.log('Welcome! Fetching your information.... ');
  40. FB.api('/me', function(response) {
  41. console.log('Good to see you, ' + response.name + '.');
  42. });
  43. }
  44.  
  45. // Load the SDK Asynchronously
  46. (function(d){
  47. var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  48. if (d.getElementById(id)) {return;}
  49. js = d.createElement('script'); js.id = id; js.async = true;
  50. js.src = "//connect.facebook.net/en_US/all.js";
  51. ref.parentNode.insertBefore(js, ref);
  52. }(document));
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement