Speed up development with full-stack environments for every branch.

Learn More

Initialize the SDK on load [facebooksdk]

63 Runs 293 Views 57 Copies
Saved

Saved

sundip 66

sundip
published 4 years ago

<html>
<head>
  <title>Init the Facebook SDK</title>
</head>
<body>
<p>How to Initialize the Facebook SDK</p>

<script type="text/javascript">

// Load the Facebook JS SDK

(function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   ref.parentNode.insertBefore(js, ref);
 }(document));


// Initialize the SDK upon load
window.fbAsyncInit = function() {
  FB.init({
    appId      : 'FACEBOOK_APP_ID', // App ID
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });

  // Add API calls here...
  // Facebook Docs: https://developers.facebook.com/docs/reference/javascript/
}
</script>
</body>
</html>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).