Facebook JavaScript SDK FB.Canvas.setSize and setAutoGrow do not work in IE7 / 8

I am currently testing a tab on Facebook. I use the JavaScript SDK with the recommended async initialization method:

window.fbAsyncInit = function() { FB.init({ appId : app_id, status : true, cookie : true, oauth : true, xfbml : true }); FB.getLoginStatus( loginStatus ); FB.Canvas.setAutoGrow( ); FB.Canvas.setSize( {height: 1200 }); }; (function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); }(document)); 

I am having problems with IE7 / 8 where setAutoGrow and setSize are not responding. My tab does NOT resize to full content. Instead, in the IE console, I get this error whenever I call setAutoGrow or setSize:

 SCRIPT438: Object doesn't support this property or method all.js, line 15 character 3916 

I tested this on PC / MAC for Chrome / FF / IE9 and everything works fine, only IE7 / 8 gives me these problems. Does anyone know if these are known errors with the FB JS SDK or am I something wrong?

+4
source share
1 answer
 <script type="text/javascript"> FB.Canvas.setSize({ width: 520, height: 1400 }); window.fbAsyncInit = function () { FB.Canvas.setAutoResize(); } </script> 

Use this and place it right before closing the body tag.

also make sure you have this markup inside body tags:

 <div id="fb-root"></div> <script type="text/javascript" src="//connect.facebook.net/en_US/all.js"></script> 
0
source

Source: https://habr.com/ru/post/1384006/


All Articles