Javascript SDK error and Canvas resizing issue-Collection of common programming errors
I’m trying to resize the Canvas for an app but I can’t get the JS SDK or the fixed height setting to work. In the console for chrome I see:
Uncaught TypeError: Object # has no method 'createClass2' on XFBML:13
Firefox:
FB.Type.createClass2 is not a function on XFBML:13
I have my app Canvas setting on fluid for width, and fixed at 1200px (which has no effect). Note: there is no Settable option.
Here is my JS SDK include. It’s right after the tag
window.fbAsyncInit = function() {
FB.init({
appId : '188042251295955', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the ...
xfbml : true // parse XFBML
});
// Additional initialization code here
FB.Canvas.setAutoGrow(100);
};
// Load the SDK Asynchronously
(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));
I would appreciate any help on this. If you can spot any errors/missing settings, that would be great.
-
I have solved the issue here. The JS SDK was erroring out when the script was loading because of (stupidly included) old scripts on the page.
#1: Old share button code.
function facebookShare(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#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); } //initialize facebookShare facebookShare(document, 'script', 'facebook-jssdk');
#2: Facebook FeatureLoader (deprecated JS SDK)
Originally posted 2013-11-30 19:06:24.