In this section, we will learn how to configure the Facebook JavaScript SDK for our application. There are no specific files to be downloaded to configure the SDK. Facebook provides a JavaScript all.js
file to call the Facebook API.
<script src="http://connect.facebook.net/en_US/all.js">
</script>
Facebook supports different locales for configuration. For our application, we have called the US English locale. In the preceding script, en_US
represents the locale parameter.
This JavaScript file can be called in the bottom section of the body to be loaded. It can also be called asynchronously by script injection. The following code shows the code to load the JavaScript library asynchronously:
<script> (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js"; fjs.parentNode.insertBefore...