Advertisement
ShawnsSpace

JS SDK async

Jun 2nd, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <div id="fb-root"></div>
  2. <script>
  3. window.fbAsyncInit = function() {
  4. FB.init({
  5. appId : '142859072412938',
  6. status : true, // check login status
  7. cookie : true, // enable cookies to allow the server to access the session
  8. xfbml : true, // parse XFBML
  9. //channelUrl : '', // channel.html file
  10. oauth : true // enable OAuth 2.0
  11. });
  12. FB.Event.subscribe('auth.login', function(response){
  13. location.reload();
  14. });
  15. FB.Event.subscribe('auth.logout', function(response){
  16. location.reload();
  17. });
  18.  
  19. };
  20. // Load the SDK Asynchronously
  21. (function(d, s, id) {
  22. var js, fjs = d.getElementsByTagName(s)[0];
  23. if (d.getElementById(id)) return;
  24. js = d.createElement(s); js.id = id;
  25. js.src = "//connect.facebook.net/en_US/all.js";
  26. fjs.parentNode.insertBefore(js, fjs);
  27. }(document, 'script', 'facebook-jssdk'));
  28. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement