{"id":1749,"date":"2022-08-30T15:19:07","date_gmt":"2022-08-30T15:19:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/30\/javascript-sdk-error-and-canvas-resizing-issue-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:07","modified_gmt":"2022-08-30T15:19:07","slug":"javascript-sdk-error-and-canvas-resizing-issue-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/javascript-sdk-error-and-canvas-resizing-issue-collection-of-common-programming-errors\/","title":{"rendered":"Javascript SDK error and Canvas resizing issue-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to resize the Canvas for an app but I can&#8217;t get the JS SDK or the fixed height setting to work. In the console for chrome I see:<\/p>\n<pre><code>Uncaught TypeError: Object # has no method 'createClass2' on XFBML:13\n<\/code><\/pre>\n<p>Firefox:<\/p>\n<pre><code>FB.Type.createClass2 is not a function on XFBML:13\n<\/code><\/pre>\n<p>I have my app Canvas setting on fluid for width, and fixed at 1200px (which has no effect). Note: there is no Settable option.<\/p>\n<p>Here is my JS SDK include. It&#8217;s right after the tag<\/p>\n<pre><code>\n  window.fbAsyncInit = function() {\n    FB.init({\n      appId      : '188042251295955', \/\/ App ID\n      status     : true, \/\/ check login status\n      cookie     : true, \/\/ enable cookies to allow the ...\n      xfbml      : true  \/\/ parse XFBML\n    });\n\n    \/\/ Additional initialization code here\n    FB.Canvas.setAutoGrow(100); \n  };\n\n  \/\/ Load the SDK Asynchronously\n  (function(d){\n     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];\n     if (d.getElementById(id)) {return;}\n     js = d.createElement('script'); js.id = id; js.async = true;\n     js.src = \"\/\/connect.facebook.net\/en_US\/all.js\";\n     ref.parentNode.insertBefore(js, ref);\n   }(document));\n\n<\/code><\/pre>\n<p>I would appreciate any help on this. If you can spot any errors\/missing settings, that would be great.<\/p>\n<ol>\n<li>\n<p>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.<\/p>\n<p>#1: Old share button code.<\/p>\n<pre><code>function facebookShare(d, s, id) {\n  var js, fjs = d.getElementsByTagName(s)[0];\n  if (d.getElementById(id)) {return;}\n  js = d.createElement(s); js.id = id;\n  js.src = \"\/\/connect.facebook.net\/en_US\/all.js#xfbml=1\";\n  fjs.parentNode.insertBefore(js, fjs);\n}\n\/\/initialize facebookShare\nfacebookShare(document, 'script', 'facebook-jssdk');\n<\/code><\/pre>\n<p>#2: Facebook FeatureLoader (deprecated JS SDK)<\/p>\n<pre><code>\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-30 19:06:24. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to resize the Canvas for an app but I can&#8217;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 &#8216;createClass2&#8217; on XFBML:13 Firefox: FB.Type.createClass2 is not a function on XFBML:13 I have my app Canvas setting on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1749","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1749"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1749\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}