Guest User

Untitled

a guest
Jul 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <body>
  2. <div id="fb-root"></div>
  3. <script>
  4. window.fbAsyncInit = function() {
  5. FB.init({appId: '[my-appid]', status: true, cookie: true, xfbml: true});
  6. //Check if user is logged-in to facebook:
  7. FB.getLoginStatus(function(response) {
  8. if (response.session) {
  9. // Here I use some FB.api functions
  10. // and get some data I need about the user's facebook profile,
  11. // and make same changes to the document html accordingly...
  12. }
  13.  
  14. });
  15. };
  16.  
  17. (function() {
  18. var e = document.createElement('script');
  19. e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
  20. e.async = true;
  21. document.getElementById('fb-root').appendChild(e);
  22. }());
  23.  
  24. </script>
  25.  
  26. FB.XFBML.parse(document.getElementById('idOfElement'));
Add Comment
Please, Sign In to add comment