The below Facebook initialization code is resulting in a JS error on page load in Chrome: Uncaught TypeError: Cannot call method 'shift' of null.
window.fbAsyncInit = function() {
FB.init({
appId : '...',
status : true,
xfbml : true
});
};
(function(){
if (document.getElementById('facebook-jssdk')) {return;}
var firstScriptElement = document.getElementsByTagName('script')[0];
var facebookJS = document.createElement('script');
facebookJS.id = 'facebook-jssdk';
facebookJS.src = '//connect.facebook.net/en_US/all.js';
firstScriptElement.parentNode.insertBefore(facebookJS, firstScriptElement);
}());
I had the same issue, and I solved by adding the Facebook JS at the top of body, just after the
<body>
tag as said on the Facebook documentationI was using version: v2.2
Look basic setup on Facbook Javascript SDK